server_tflite.cpp 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697
  1. #include "server_tflite.h"
  2. #include <string>
  3. #include <vector>
  4. #include "string.h"
  5. #include "esp_log.h"
  6. #include <iomanip>
  7. #include <sstream>
  8. #include "defines.h"
  9. #include "Helper.h"
  10. #include "esp_camera.h"
  11. #include "time_sntp.h"
  12. #include "ClassControllCamera.h"
  13. #include "ClassFlowControll.h"
  14. #include "ClassLogFile.h"
  15. #include "server_GPIO.h"
  16. // #define DEBUG_DETAIL_ON
  17. ClassFlowControll tfliteflow;
  18. TaskHandle_t xHandleblink_task_doFlow = NULL;
  19. TaskHandle_t xHandletask_autodoFlow = NULL;
  20. bool flowisrunning = false;
  21. long auto_intervall = 0;
  22. bool auto_isrunning = false;
  23. int countRounds = 0;
  24. static const char *TAGTFLITE = "server_tflite";
  25. int getCountFlowRounds() {
  26. return countRounds;
  27. }
  28. esp_err_t GetJPG(std::string _filename, httpd_req_t *req)
  29. {
  30. return tfliteflow.GetJPGStream(_filename, req);
  31. }
  32. esp_err_t GetRawJPG(httpd_req_t *req)
  33. {
  34. return tfliteflow.SendRawJPG(req);
  35. }
  36. bool isSetupModusActive() {
  37. return tfliteflow.getStatusSetupModus();
  38. return false;
  39. }
  40. void KillTFliteTasks()
  41. {
  42. #ifdef DEBUG_DETAIL_ON
  43. printf("Handle: xHandleblink_task_doFlow: %ld\n", (long) xHandleblink_task_doFlow);
  44. #endif
  45. if (xHandleblink_task_doFlow != NULL)
  46. {
  47. TaskHandle_t xHandleblink_task_doFlowTmp = xHandleblink_task_doFlow;
  48. xHandleblink_task_doFlow = NULL;
  49. vTaskDelete(xHandleblink_task_doFlowTmp);
  50. #ifdef DEBUG_DETAIL_ON
  51. printf("Killed: xHandleblink_task_doFlow\n");
  52. #endif
  53. }
  54. #ifdef DEBUG_DETAIL_ON
  55. printf("Handle: xHandletask_autodoFlow: %ld\n", (long) xHandletask_autodoFlow);
  56. #endif
  57. if (xHandletask_autodoFlow != NULL)
  58. {
  59. TaskHandle_t xHandletask_autodoFlowTmp = xHandletask_autodoFlow;
  60. xHandletask_autodoFlow = NULL;
  61. vTaskDelete(xHandletask_autodoFlowTmp);
  62. #ifdef DEBUG_DETAIL_ON
  63. printf("Killed: xHandletask_autodoFlow\n");
  64. #endif
  65. }
  66. }
  67. void doInit(void)
  68. {
  69. #ifdef DEBUG_DETAIL_ON
  70. printf("Start tfliteflow.InitFlow(config);\n");
  71. #endif
  72. tfliteflow.InitFlow(CONFIG_FILE);
  73. #ifdef DEBUG_DETAIL_ON
  74. printf("Finished tfliteflow.InitFlow(config);\n");
  75. #endif
  76. }
  77. bool doflow(void)
  78. {
  79. std::string zw_time = gettimestring(LOGFILE_TIME_FORMAT);
  80. printf("doflow - start %s\n", zw_time.c_str());
  81. flowisrunning = true;
  82. tfliteflow.doFlow(zw_time);
  83. flowisrunning = false;
  84. #ifdef DEBUG_DETAIL_ON
  85. printf("doflow - end %s\n", zw_time.c_str());
  86. #endif
  87. return true;
  88. }
  89. void blink_task_doFlow(void *pvParameter)
  90. {
  91. #ifdef DEBUG_DETAIL_ON
  92. printf("blink_task_doFlow\n");
  93. #endif
  94. if (!flowisrunning)
  95. {
  96. flowisrunning = true;
  97. doflow();
  98. flowisrunning = false;
  99. }
  100. vTaskDelete(NULL); //Delete this task if it exits from the loop above
  101. xHandleblink_task_doFlow = NULL;
  102. }
  103. esp_err_t handler_init(httpd_req_t *req)
  104. {
  105. #ifdef DEBUG_DETAIL_ON
  106. LogFile.WriteHeapInfo("handler_init - Start");
  107. printf("handler_doinit uri:\n"); printf(req->uri); printf("\n");
  108. #endif
  109. const char* resp_str = "Init started<br>";
  110. httpd_resp_send(req, resp_str, strlen(resp_str));
  111. doInit();
  112. resp_str = "Init done<br>";
  113. httpd_resp_send(req, resp_str, strlen(resp_str));
  114. /* Respond with an empty chunk to signal HTTP response completion */
  115. httpd_resp_send_chunk(req, NULL, 0);
  116. #ifdef DEBUG_DETAIL_ON
  117. LogFile.WriteHeapInfo("handler_init - Done");
  118. #endif
  119. return ESP_OK;
  120. };
  121. esp_err_t handler_doflow(httpd_req_t *req)
  122. {
  123. #ifdef DEBUG_DETAIL_ON
  124. LogFile.WriteHeapInfo("handler_doflow - Start");
  125. #endif
  126. printf("handler_doFlow uri: "); printf(req->uri); printf("\n");
  127. if (flowisrunning)
  128. {
  129. const char* resp_str = "doFlow läuft bereits und kann nicht nochmal gestartet werden";
  130. httpd_resp_send(req, resp_str, strlen(resp_str));
  131. return 2;
  132. }
  133. else
  134. {
  135. xTaskCreate(&blink_task_doFlow, "blink_doFlow", configMINIMAL_STACK_SIZE * 64, NULL, tskIDLE_PRIORITY+1, &xHandleblink_task_doFlow);
  136. }
  137. const char* resp_str = "doFlow gestartet - dauert ca. 60 Sekunden";
  138. httpd_resp_send(req, resp_str, strlen(resp_str));
  139. /* Respond with an empty chunk to signal HTTP response completion */
  140. httpd_resp_send_chunk(req, NULL, 0);
  141. #ifdef DEBUG_DETAIL_ON
  142. LogFile.WriteHeapInfo("handler_doflow - Done");
  143. #endif
  144. return ESP_OK;
  145. };
  146. esp_err_t handler_wasserzaehler(httpd_req_t *req)
  147. {
  148. #ifdef DEBUG_DETAIL_ON
  149. LogFile.WriteHeapInfo("handler_wasserzaehler - Start");
  150. #endif
  151. bool _rawValue = false;
  152. bool _noerror = false;
  153. bool _all = false;
  154. std::string _type = "value";
  155. string zw;
  156. printf("handler_wasserzaehler uri:\n"); printf(req->uri); printf("\n");
  157. char _query[100];
  158. char _size[10];
  159. if (httpd_req_get_url_query_str(req, _query, 100) == ESP_OK)
  160. {
  161. // printf("Query: "); printf(_query); printf("\n");
  162. if (httpd_query_key_value(_query, "all", _size, 10) == ESP_OK)
  163. {
  164. #ifdef DEBUG_DETAIL_ON
  165. printf("all is found"); printf(_size); printf("\n");
  166. #endif
  167. _all = true;
  168. }
  169. if (httpd_query_key_value(_query, "type", _size, 10) == ESP_OK)
  170. {
  171. #ifdef DEBUG_DETAIL_ON
  172. printf("all is found"); printf(_size); printf("\n");
  173. #endif
  174. _type = std::string(_size);
  175. }
  176. if (httpd_query_key_value(_query, "rawvalue", _size, 10) == ESP_OK)
  177. {
  178. #ifdef DEBUG_DETAIL_ON
  179. printf("rawvalue is found"); printf(_size); printf("\n");
  180. #endif
  181. _rawValue = true;
  182. }
  183. if (httpd_query_key_value(_query, "noerror", _size, 10) == ESP_OK)
  184. {
  185. #ifdef DEBUG_DETAIL_ON
  186. printf("noerror is found"); printf(_size); printf("\n");
  187. #endif
  188. _noerror = true;
  189. }
  190. }
  191. httpd_resp_set_hdr(req, "Access-Control-Allow-Origin", "*");
  192. if (_all)
  193. {
  194. httpd_resp_set_type(req, "text/plain");
  195. printf("TYPE: %s\n", _type.c_str());
  196. int _intype = READOUT_TYPE_VALUE;
  197. if (_type == "prevalue")
  198. _intype = READOUT_TYPE_PREVALUE;
  199. if (_type == "raw")
  200. _intype = READOUT_TYPE_RAWVALUE;
  201. if (_type == "error")
  202. _intype = READOUT_TYPE_ERROR;
  203. zw = tfliteflow.getReadoutAll(_intype);
  204. printf("ZW: %s\n", zw.c_str());
  205. if (zw.length() > 0)
  206. httpd_resp_sendstr_chunk(req, zw.c_str());
  207. httpd_resp_sendstr_chunk(req, NULL);
  208. return ESP_OK;
  209. }
  210. zw = tfliteflow.getReadout(_rawValue, _noerror);
  211. if (zw.length() > 0)
  212. httpd_resp_sendstr_chunk(req, zw.c_str());
  213. string query = std::string(_query);
  214. // printf("Query: %s\n", query.c_str());
  215. if (query.find("full") != std::string::npos)
  216. {
  217. string txt, zw;
  218. txt = "<p>Aligned Image: <p><img src=\"/img_tmp/alg_roi.jpg\"> <p>\n";
  219. txt = txt + "Digital Counter: <p> ";
  220. httpd_resp_sendstr_chunk(req, txt.c_str());
  221. std::vector<HTMLInfo*> htmlinfo;
  222. htmlinfo = tfliteflow.GetAllDigital();
  223. for (int i = 0; i < htmlinfo.size(); ++i)
  224. {
  225. if (htmlinfo[i]->val == 10)
  226. zw = "NaN";
  227. else
  228. {
  229. zw = to_string((int) htmlinfo[i]->val);
  230. }
  231. txt = "<img src=\"/img_tmp/" + htmlinfo[i]->filename + "\"> " + zw;
  232. httpd_resp_sendstr_chunk(req, txt.c_str());
  233. delete htmlinfo[i];
  234. }
  235. htmlinfo.clear();
  236. txt = " <p> Analog Meter: <p> ";
  237. httpd_resp_sendstr_chunk(req, txt.c_str());
  238. htmlinfo = tfliteflow.GetAllAnalog();
  239. for (int i = 0; i < htmlinfo.size(); ++i)
  240. {
  241. std::stringstream stream;
  242. stream << std::fixed << std::setprecision(1) << htmlinfo[i]->val;
  243. zw = stream.str();
  244. txt = "<img src=\"/img_tmp/" + htmlinfo[i]->filename + "\"> " + zw;
  245. httpd_resp_sendstr_chunk(req, txt.c_str());
  246. delete htmlinfo[i];
  247. }
  248. htmlinfo.clear();
  249. }
  250. /* Respond with an empty chunk to signal HTTP response completion */
  251. httpd_resp_sendstr_chunk(req, NULL);
  252. #ifdef DEBUG_DETAIL_ON
  253. LogFile.WriteHeapInfo("handler_wasserzaehler - Done");
  254. #endif
  255. return ESP_OK;
  256. };
  257. esp_err_t handler_editflow(httpd_req_t *req)
  258. {
  259. #ifdef DEBUG_DETAIL_ON
  260. LogFile.WriteHeapInfo("handler_editflow - Start");
  261. #endif
  262. printf("handler_editflow uri: "); printf(req->uri); printf("\n");
  263. char _query[200];
  264. char _valuechar[30];
  265. string _task;
  266. if (httpd_req_get_url_query_str(req, _query, 200) == ESP_OK)
  267. {
  268. if (httpd_query_key_value(_query, "task", _valuechar, 30) == ESP_OK)
  269. {
  270. #ifdef DEBUG_DETAIL_ON
  271. printf("task is found: %s\n", _valuechar);
  272. #endif
  273. _task = string(_valuechar);
  274. }
  275. }
  276. if (_task.compare("copy") == 0)
  277. {
  278. string in, out, zw;
  279. httpd_query_key_value(_query, "in", _valuechar, 30);
  280. in = string(_valuechar);
  281. httpd_query_key_value(_query, "out", _valuechar, 30);
  282. out = string(_valuechar);
  283. #ifdef DEBUG_DETAIL_ON
  284. printf("in: "); printf(in.c_str()); printf("\n");
  285. printf("out: "); printf(out.c_str()); printf("\n");
  286. #endif
  287. in = "/sdcard" + in;
  288. out = "/sdcard" + out;
  289. CopyFile(in, out);
  290. zw = "Copy Done";
  291. httpd_resp_sendstr_chunk(req, zw.c_str());
  292. }
  293. if (_task.compare("cutref") == 0)
  294. {
  295. string in, out, zw;
  296. int x, y, dx, dy;
  297. bool enhance = false;
  298. httpd_query_key_value(_query, "in", _valuechar, 30);
  299. in = string(_valuechar);
  300. httpd_query_key_value(_query, "out", _valuechar, 30);
  301. out = string(_valuechar);
  302. httpd_query_key_value(_query, "x", _valuechar, 30);
  303. zw = string(_valuechar);
  304. x = stoi(zw);
  305. httpd_query_key_value(_query, "y", _valuechar, 30);
  306. zw = string(_valuechar);
  307. y = stoi(zw);
  308. httpd_query_key_value(_query, "dx", _valuechar, 30);
  309. zw = string(_valuechar);
  310. dx = stoi(zw);
  311. httpd_query_key_value(_query, "dy", _valuechar, 30);
  312. zw = string(_valuechar);
  313. dy = stoi(zw);
  314. #ifdef DEBUG_DETAIL_ON
  315. printf("in: "); printf(in.c_str()); printf("\n");
  316. printf("out: "); printf(out.c_str()); printf("\n");
  317. printf("x: "); printf(zw.c_str()); printf("\n");
  318. printf("y: "); printf(zw.c_str()); printf("\n");
  319. printf("dx: "); printf(zw.c_str()); printf("\n");
  320. printf("dy: "); printf(zw.c_str()); printf("\n");
  321. #endif
  322. if (httpd_query_key_value(_query, "enhance", _valuechar, 10) == ESP_OK)
  323. {
  324. zw = string(_valuechar);
  325. if (zw.compare("true") == 0)
  326. {
  327. enhance = true;
  328. }
  329. }
  330. in = "/sdcard" + in;
  331. out = "/sdcard" + out;
  332. string out2 = out.substr(0, out.length() - 4) + "_org.jpg";
  333. CAlignAndCutImage *caic = new CAlignAndCutImage(in);
  334. caic->CutAndSave(out2, x, y, dx, dy);
  335. delete caic;
  336. CImageBasis *cim = new CImageBasis(out2);
  337. if (enhance)
  338. {
  339. cim->Contrast(90);
  340. }
  341. cim->SaveToFile(out);
  342. delete cim;
  343. zw = "CutImage Done";
  344. httpd_resp_sendstr_chunk(req, zw.c_str());
  345. }
  346. if (_task.compare("test_take") == 0)
  347. {
  348. std::string _host = "";
  349. std::string _bri = "";
  350. std::string _con = "";
  351. std::string _sat = "";
  352. int bri = -100;
  353. int sat = -100;
  354. int con = -100;
  355. if (httpd_query_key_value(_query, "host", _valuechar, 30) == ESP_OK) {
  356. _host = std::string(_valuechar);
  357. }
  358. if (httpd_query_key_value(_query, "bri", _valuechar, 30) == ESP_OK) {
  359. _bri = std::string(_valuechar);
  360. bri = stoi(_bri);
  361. }
  362. if (httpd_query_key_value(_query, "con", _valuechar, 30) == ESP_OK) {
  363. _con = std::string(_valuechar);
  364. con = stoi(_con);
  365. }
  366. if (httpd_query_key_value(_query, "sat", _valuechar, 30) == ESP_OK) {
  367. _sat = std::string(_valuechar);
  368. sat = stoi(_sat);
  369. }
  370. // printf("Parameter host: "); printf(_host.c_str()); printf("\n");
  371. // string zwzw = "Do " + _task + " start\n"; printf(zwzw.c_str());
  372. Camera.SetBrightnessContrastSaturation(bri, con, sat);
  373. std::string zw = tfliteflow.doSingleStep("[MakeImage]", _host);
  374. httpd_resp_sendstr_chunk(req, zw.c_str());
  375. }
  376. if (_task.compare("test_align") == 0)
  377. {
  378. std::string _host = "";
  379. if (httpd_query_key_value(_query, "host", _valuechar, 30) == ESP_OK) {
  380. _host = std::string(_valuechar);
  381. }
  382. // printf("Parameter host: "); printf(_host.c_str()); printf("\n");
  383. // string zwzw = "Do " + _task + " start\n"; printf(zwzw.c_str());
  384. std::string zw = tfliteflow.doSingleStep("[Alignment]", _host);
  385. httpd_resp_sendstr_chunk(req, zw.c_str());
  386. }
  387. if (_task.compare("test_analog") == 0)
  388. {
  389. std::string _host = "";
  390. if (httpd_query_key_value(_query, "host", _valuechar, 30) == ESP_OK) {
  391. _host = std::string(_valuechar);
  392. }
  393. // printf("Parameter host: "); printf(_host.c_str()); printf("\n");
  394. // string zwzw = "Do " + _task + " start\n"; printf(zwzw.c_str());
  395. std::string zw = tfliteflow.doSingleStep("[Analog]", _host);
  396. httpd_resp_sendstr_chunk(req, zw.c_str());
  397. }
  398. if (_task.compare("test_digits") == 0)
  399. {
  400. std::string _host = "";
  401. if (httpd_query_key_value(_query, "host", _valuechar, 30) == ESP_OK) {
  402. _host = std::string(_valuechar);
  403. }
  404. // printf("Parameter host: "); printf(_host.c_str()); printf("\n");
  405. // string zwzw = "Do " + _task + " start\n"; printf(zwzw.c_str());
  406. std::string zw = tfliteflow.doSingleStep("[Digits]", _host);
  407. httpd_resp_sendstr_chunk(req, zw.c_str());
  408. }
  409. /* Respond with an empty chunk to signal HTTP response completion */
  410. httpd_resp_sendstr_chunk(req, NULL);
  411. #ifdef DEBUG_DETAIL_ON
  412. LogFile.WriteHeapInfo("handler_editflow - Done");
  413. #endif
  414. return ESP_OK;
  415. };
  416. esp_err_t handler_prevalue(httpd_req_t *req)
  417. {
  418. #ifdef DEBUG_DETAIL_ON
  419. LogFile.WriteHeapInfo("handler_prevalue - Start");
  420. #endif
  421. const char* resp_str;
  422. string zw;
  423. #ifdef DEBUG_DETAIL_ON
  424. printf("handler_prevalue:\n"); printf(req->uri); printf("\n");
  425. #endif
  426. char _query[100];
  427. char _size[10] = "";
  428. char _numbers[50] = "default";
  429. if (httpd_req_get_url_query_str(req, _query, 100) == ESP_OK)
  430. {
  431. #ifdef DEBUG_DETAIL_ON
  432. printf("Query: "); printf(_query); printf("\n");
  433. #endif
  434. if (httpd_query_key_value(_query, "value", _size, 10) == ESP_OK)
  435. {
  436. #ifdef DEBUG_DETAIL_ON
  437. printf("Value: "); printf(_size); printf("\n");
  438. #endif
  439. }
  440. httpd_query_key_value(_query, "numbers", _numbers, 50);
  441. }
  442. if (strlen(_size) == 0)
  443. {
  444. zw = tfliteflow.GetPrevalue(std::string(_numbers));
  445. }
  446. else
  447. {
  448. zw = "SetPrevalue to " + tfliteflow.UpdatePrevalue(_size, _numbers, true);
  449. }
  450. resp_str = zw.c_str();
  451. httpd_resp_set_hdr(req, "Access-Control-Allow-Origin", "*");
  452. httpd_resp_send(req, resp_str, strlen(resp_str));
  453. /* Respond with an empty chunk to signal HTTP response completion */
  454. httpd_resp_send_chunk(req, NULL, 0);
  455. #ifdef DEBUG_DETAIL_ON
  456. LogFile.WriteHeapInfo("handler_prevalue - Start");
  457. #endif
  458. return ESP_OK;
  459. };
  460. void task_autodoFlow(void *pvParameter)
  461. {
  462. int64_t fr_start, fr_delta_ms;
  463. printf("task_autodoFlow: start\r\n");
  464. doInit();
  465. gpio_handler_init();
  466. auto_isrunning = tfliteflow.isAutoStart(auto_intervall);
  467. if (isSetupModusActive()) {
  468. auto_isrunning = false;
  469. std::string zw_time = gettimestring(LOGFILE_TIME_FORMAT);
  470. tfliteflow.doFlowMakeImageOnly(zw_time);
  471. }
  472. while (auto_isrunning)
  473. {
  474. std::string _zw = "task_autodoFlow - next round - Round #" + std::to_string(++countRounds);
  475. LogFile.WriteToFile(_zw);
  476. printf("Autoflow: start\n");
  477. fr_start = esp_timer_get_time();
  478. if (flowisrunning)
  479. {
  480. #ifdef DEBUG_DETAIL_ON
  481. printf("Autoflow: doFLow laeuft bereits!\n");
  482. #endif
  483. }
  484. else
  485. {
  486. #ifdef DEBUG_DETAIL_ON
  487. printf("Autoflow: doFLow wird gestartet\n");
  488. #endif
  489. flowisrunning = true;
  490. doflow();
  491. #ifdef DEBUG_DETAIL_ON
  492. printf("Remove older log files\n");
  493. #endif
  494. LogFile.RemoveOld();
  495. }
  496. LogFile.WriteToFile("task_autodoFlow - round done");
  497. //CPU Temp
  498. float cputmp = temperatureRead();
  499. std::stringstream stream;
  500. stream << std::fixed << std::setprecision(1) << cputmp;
  501. string zwtemp = "CPU Temperature: " + stream.str();
  502. LogFile.WriteToFile(zwtemp);
  503. printf("CPU Temperature: %.2f\n", cputmp);
  504. fr_delta_ms = (esp_timer_get_time() - fr_start) / 1000;
  505. if (auto_intervall > fr_delta_ms)
  506. {
  507. const TickType_t xDelay = (auto_intervall - fr_delta_ms) / portTICK_PERIOD_MS;
  508. printf("Autoflow: sleep for : %ldms\n", (long) xDelay);
  509. vTaskDelay( xDelay );
  510. }
  511. }
  512. vTaskDelete(NULL); //Delete this task if it exits from the loop above
  513. xHandletask_autodoFlow = NULL;
  514. printf("task_autodoFlow: end\r\n");
  515. }
  516. void TFliteDoAutoStart()
  517. {
  518. xTaskCreate(&task_autodoFlow, "task_autodoFlow", configMINIMAL_STACK_SIZE * 64, NULL, tskIDLE_PRIORITY+1, &xHandletask_autodoFlow);
  519. }
  520. std::string GetMQTTMainTopic()
  521. {
  522. return tfliteflow.GetMQTTMainTopic();
  523. }
  524. void register_server_tflite_uri(httpd_handle_t server)
  525. {
  526. ESP_LOGI(TAGTFLITE, "server_part_camera - Registering URI handlers");
  527. httpd_uri_t camuri = { };
  528. camuri.method = HTTP_GET;
  529. camuri.uri = "/doinit";
  530. camuri.handler = handler_init;
  531. camuri.user_ctx = (void*) "Light On";
  532. httpd_register_uri_handler(server, &camuri);
  533. camuri.uri = "/setPreValue.html";
  534. camuri.handler = handler_prevalue;
  535. camuri.user_ctx = (void*) "Prevalue";
  536. httpd_register_uri_handler(server, &camuri);
  537. camuri.uri = "/doflow";
  538. camuri.handler = handler_doflow;
  539. camuri.user_ctx = (void*) "Light Off";
  540. httpd_register_uri_handler(server, &camuri);
  541. camuri.uri = "/editflow.html";
  542. camuri.handler = handler_editflow;
  543. camuri.user_ctx = (void*) "EditFlow";
  544. httpd_register_uri_handler(server, &camuri);
  545. camuri.uri = "/wasserzaehler.html";
  546. camuri.handler = handler_wasserzaehler;
  547. camuri.user_ctx = (void*) "Wasserzaehler";
  548. httpd_register_uri_handler(server, &camuri);
  549. }