You are using the 15 month old core that has loads of bugs that have been fixed but I wouldn’t make the switch until we have seen a proper Serial Monitor output.
You need to use GPIO references in your sketch not the Dx references. You could just define the pin mappings e.g.
#define Dx y
Upgrading to 2.40-rc1 or even the master will be a big improvement over 2.30 but I suspect you have something fundamentally wrong with your sketch / hardware.
You are multiplexing right?
Split the code into sections and just run each part to try and isolate the issue.
I did a little change on the code yesterday night and selected a different set of data to get de “PWM duty v/s time”. And for more than 8 hours, no problems at all.
But I suspect is something related with the PWM duty changes when I set a different value to change de light. I will keep it running all day to see what happens.
I have two cloned ESP8266 boards running, one in my aquarium and other in a bread board, connected to my computer. It’s a good way to test because the fail happens in both at the same time. And how the boardd just act according to the parameters sent by Blynk, there isn’t any conflict.
To try, I just upgraded the core for the testing ESP on the bread board.
I’m electronic engineer… I’m not doing multiplexing as we electronics understand. May be from a software point of view.
I’m doing a for loop to select the PWM Channel, and set the right duty cicle for each channel according to the parameters set on the blynk app. That’s why I’m ussing arrays.
For example. the following code in my sketch reads the memory where I have stored “curve values”. It get’s the right value depending of the time start and time end configured for each channel:
for (i = 0; i < 4; i = i + 1)
{
if ( (FotoPeriodo_Fin_Canal[i] - FotoPeriodo_Inicio_Canal[i]) != 0 )
{
Minuto_Ajustado = ( h*60 + m - FotoPeriodo_Inicio_Canal[i]) * 1020 / (FotoPeriodo_Fin_Canal[i] - FotoPeriodo_Inicio_Canal[i]);
}
else
{
Minuto_Ajustado = ( h*60 + m - FotoPeriodo_Inicio_Canal[i]);
Serial.println("Error de fotoperiodo");
}
if ( Minuto_Ajustado < 0 ) Minuto_Ajustado = 0;
if ( Minuto_Ajustado > 1020) Minuto_Ajustado = 1020;
posmem = (Modo-2)*2042 + (Minuto_Ajustado)*2;
uint8_t byteval_1 = pgm_read_byte(curvas + posmem);
posmem = posmem + 1;
uint8_t byteval_2 = pgm_read_byte(curvas + posmem);
if ( Luz[i] > 100) Luz[i] = 100;
potCanal[i] = (byteval_1*256 + byteval_2)*Luz[i]/100;
if ( (i == Luz_Luna - 2) && (potCanal[i] <= 10) ) potCanal[i] = 50;
int x;
x = luz_anterior[i] - potCanal[i];
if ( abs(x) >= 500 )
{
deltaLuz[i] = ( potCanal[i] - luz_anterior[i] ) / 10;
int Conteo_Segundos = 0;
long millis_anterior = 0;
long millis_actual = 0;
terminal.println(F("-----------------"));
terminal.println("* Cambio Suave *");
terminal.flush();
Serial.println("* Cambio Suave *");
Blynk.disconnect();
while (Conteo_Segundos < 10)
{
millis_actual = millis();
yield();
if ( (millis_actual - millis_anterior) > 1000 )
{
millis_anterior = millis_actual;
Conteo_Segundos = Conteo_Segundos + 1;
potCanal[i] = luz_anterior[i] + deltaLuz[i];
if ( ( i == Luz_Luna - 2 ) && ( potCanal[i] <= 50 ) && ( potCanal[i] <= luz_anterior[i] ) ) potCanal[i] = 50;
pwm_set_duty(potCanal[i], i );
pwm_start(); // commit
luz_anterior[i] = potCanal[i];
}
}
Blynk.connect();
}
pwm_set_duty(potCanal[i], i );
pwm_start(); // commit
luz_anterior[i] = potCanal[i];
}
actually got reseted by watchdog! this means that somewhere somehow there is a function with very long or infinite cycle. this makes the watchdog angry. pour that reset message -without the date- into google and see what it means.
now theoretically you’re one step closer to the problem.
the clone esp which is still runing, has the old core?