Hi guys,
I am trying to customize a firmware to ESP32 but after OTA, new code works only until restart.
I am doing the following:
mos clone https://github.com/mongoose-os-apps/demo-c app4
mos build
mos flash
mos wifi WIFI_NETWORK WIFI_PASSWORD
- now I create a device no mdash and copy the TOKEN
mos config-set dash.enable=true dash.token=TOKEN
Then I changed the file main.c including some code to light leds connected to ESP32 GPIOs
#include <stdio.h>
#include <time.h>
int reles_PIN[]={27,33,32,21,19,18,17,16};
void delay(int milli_seconds) {
clock_t start_time = clock(); // Storing start time
while (clock() < start_time + milli_seconds); // looping till required time is not achieved
}
for (int i = 0; i < 8; ++i){
mgos_gpio_toggle(reles_PIN[i]); //toggle relays pin
delay(300); //wait 300ms
}
for (int i = 0; i < 8; ++i){
mgos_gpio_setup_output(reles_PIN[i], 0); // set relay ports as output
}
Then I build the code using
mos build
And upload the firmware to ESP32 using mdash
After upload finish, the code runs as expected but after some time or if I do a reset the ESP32 returns to original code.
What I need to do to commit the new code into the ESP32 ?
I will appreciate any help.
Thank you and Regards
José Luiz