mirror of
https://github.com/jomjol/AI-on-the-edge-device.git
synced 2025-12-08 12:36:52 +03:00
Update README.md
improve case if gpio is disabled remove /test html route
This commit is contained in:
16
README.md
16
README.md
@@ -45,7 +45,23 @@ In other cases you can contact the developer via email: <img src="https://raw.gi
|
|||||||
|
|
||||||
**General remark:** Beside the `firmware.bin`, typically also the content of `/html` needs to be updated!
|
**General remark:** Beside the `firmware.bin`, typically also the content of `/html` needs to be updated!
|
||||||
|
|
||||||
|
##### Rolling - (2021-07-11)
|
||||||
|
|
||||||
|
* GPIO: implements basic functionality for GPIO handler.
|
||||||
|
- Configuration via config.ini / HTML page
|
||||||
|
- GPIO 12, 13, 1, 3, 0, 4 can be used (see restrictions in HTML configuration page)
|
||||||
|
- GPIO can be used as input or output
|
||||||
|
- pullup / pulldown can be enabled
|
||||||
|
- supports all interrupt types of the ESP32
|
||||||
|
- publishing via MQTT or HTTP
|
||||||
|
- definition of the MQTT topic name
|
||||||
|
* HTML: implements regex mask for text input fields (currently enabled for GPIO inputs and main topic)
|
||||||
|
* HTML: automatic detection of select fields
|
||||||
|
* MQTT: added readings for uptime and freeMem (can be used for tracking with Infux DB and as memory leak detection)
|
||||||
|
* MQTT: connection is no longer terminated and reestablished on each flow
|
||||||
|
* Classe ConfigFile created. Can be used by all components in the future.
|
||||||
|
* Bugfix: memory leaks in ClassFlowAnalog and ClassFlowControll fixed.
|
||||||
|
* Removed compiler warnings
|
||||||
|
|
||||||
##### Rolling - (2021-07-08)
|
##### Rolling - (2021-07-08)
|
||||||
|
|
||||||
|
|||||||
@@ -217,7 +217,12 @@ void GpioHandler::init()
|
|||||||
}
|
}
|
||||||
|
|
||||||
ESP_LOGI(TAG_SERVERGPIO, "read GPIO config and init GPIO");
|
ESP_LOGI(TAG_SERVERGPIO, "read GPIO config and init GPIO");
|
||||||
readConfig();
|
if (!readConfig()) {
|
||||||
|
clear();
|
||||||
|
delete gpioMap;
|
||||||
|
gpioMap = NULL;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
for(std::map<gpio_num_t, GpioPin*>::iterator it = gpioMap->begin(); it != gpioMap->end(); ++it) {
|
for(std::map<gpio_num_t, GpioPin*>::iterator it = gpioMap->begin(); it != gpioMap->end(); ++it) {
|
||||||
it->second->init();
|
it->second->init();
|
||||||
@@ -289,8 +294,12 @@ bool GpioHandler::readConfig()
|
|||||||
while ((!configFile.GetNextParagraph(line, disabledLine, eof) || (line.compare("[GPIO]") != 0)) && !disabledLine && !eof) {}
|
while ((!configFile.GetNextParagraph(line, disabledLine, eof) || (line.compare("[GPIO]") != 0)) && !disabledLine && !eof) {}
|
||||||
if (eof)
|
if (eof)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
_isEnabled = !disabledLine;
|
||||||
|
|
||||||
|
if (!_isEnabled)
|
||||||
|
return false;
|
||||||
|
|
||||||
_isEnabled = true;
|
|
||||||
std::string mainTopicMQTT = "";
|
std::string mainTopicMQTT = "";
|
||||||
bool registerISR = false;
|
bool registerISR = false;
|
||||||
while (configFile.getNextLine(&line, disabledLine, eof) && !configFile.isNewParagraph(line))
|
while (configFile.getNextLine(&line, disabledLine, eof) && !configFile.isNewParagraph(line))
|
||||||
|
|||||||
@@ -62,14 +62,14 @@ static void infinite_loop(void)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
static bool ota_example_task(std::string fn)
|
static bool ota_update_task(std::string fn)
|
||||||
{
|
{
|
||||||
esp_err_t err;
|
esp_err_t err;
|
||||||
/* update handle : set by esp_ota_begin(), must be freed via esp_ota_end() */
|
/* update handle : set by esp_ota_begin(), must be freed via esp_ota_end() */
|
||||||
esp_ota_handle_t update_handle = 0 ;
|
esp_ota_handle_t update_handle = 0 ;
|
||||||
const esp_partition_t *update_partition = NULL;
|
const esp_partition_t *update_partition = NULL;
|
||||||
|
|
||||||
ESP_LOGI(TAGPARTOTA, "Starting OTA example");
|
ESP_LOGI(TAGPARTOTA, "Starting OTA update");
|
||||||
|
|
||||||
const esp_partition_t *configured = esp_ota_get_boot_partition();
|
const esp_partition_t *configured = esp_ota_get_boot_partition();
|
||||||
const esp_partition_t *running = esp_ota_get_running_partition();
|
const esp_partition_t *running = esp_ota_get_running_partition();
|
||||||
@@ -378,7 +378,7 @@ esp_err_t handler_ota_update(httpd_req_t *req)
|
|||||||
|
|
||||||
KillTFliteTasks();
|
KillTFliteTasks();
|
||||||
gpio_handler_deinit();
|
gpio_handler_deinit();
|
||||||
if (ota_example_task(fn))
|
if (ota_update_task(fn))
|
||||||
{
|
{
|
||||||
resp_str = "Firmware Update Successfull!<br><br>You can restart now.";
|
resp_str = "Firmware Update Successfull!<br><br>You can restart now.";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -135,17 +135,6 @@ void task_NoSDBlink(void *pvParameter)
|
|||||||
vTaskDelete(NULL); //Delete this task if it exits from the loop above
|
vTaskDelete(NULL); //Delete this task if it exits from the loop above
|
||||||
}
|
}
|
||||||
|
|
||||||
esp_err_t handler_gpio(httpd_req_t *req)
|
|
||||||
{
|
|
||||||
gpio_handler_init();
|
|
||||||
|
|
||||||
char resp_str [30];
|
|
||||||
sprintf(resp_str, "OK. freemem %u", esp_get_free_heap_size());
|
|
||||||
httpd_resp_send(req, resp_str, strlen(resp_str));
|
|
||||||
|
|
||||||
return ESP_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
extern "C" void app_main(void)
|
extern "C" void app_main(void)
|
||||||
{
|
{
|
||||||
printf("Do Reset Camera\n");
|
printf("Do Reset Camera\n");
|
||||||
@@ -210,13 +199,6 @@ extern "C" void app_main(void)
|
|||||||
register_server_file_uri(server, "/sdcard");
|
register_server_file_uri(server, "/sdcard");
|
||||||
register_server_ota_sdcard_uri(server);
|
register_server_ota_sdcard_uri(server);
|
||||||
|
|
||||||
httpd_uri_t camuri = { };
|
|
||||||
camuri.method = HTTP_GET;
|
|
||||||
camuri.uri = "/test";
|
|
||||||
camuri.handler = handler_gpio;
|
|
||||||
camuri.user_ctx = (void*)server;
|
|
||||||
httpd_register_uri_handler(server, &camuri);
|
|
||||||
|
|
||||||
gpio_handler_create(server);
|
gpio_handler_create(server);
|
||||||
|
|
||||||
printf("vor reg server main\n");
|
printf("vor reg server main\n");
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
@@ -56,7 +56,7 @@ CheckDigitIncreaseConsistency = true
|
|||||||
;password = PASSWORD
|
;password = PASSWORD
|
||||||
|
|
||||||
;[GPIO]
|
;[GPIO]
|
||||||
;MainTopicMQTT = watermeter2/GPIO
|
;MainTopicMQTT = wasserzaehler/GPIO
|
||||||
;IO0 = input disabled 10 false false
|
;IO0 = input disabled 10 false false
|
||||||
;IO1 = input disabled 10 false false
|
;IO1 = input disabled 10 false false
|
||||||
;IO3 = input disabled 10 false false
|
;IO3 = input disabled 10 false false
|
||||||
|
|||||||
Reference in New Issue
Block a user