Closed polygontwist closed 6 years ago
ok, the brightness control does not work...
Hello @polygontwist, thanks! Will try it out later
I tried different (timings) but didn't get it to run without flicker in the task. I'm trying interrupt again: If I stop the interrupt before sending data to the client it sometimes works. My scripts now run in two tasks (xTaskCreatePinnedToCore) at Core 0 (draw matrix; OTA+Wifi+Serialinput+getNTP). Sometimes I get "Guru Meditation Error: Core 1 panic'ed (Cache disabled but cached memory region accessed)". With timerAlarmWrite(displayUpdateTimer, 20, true); it is better - but not the display. I'll keep trying...
I've now worked out a solution that seems to be working. Before I process the HTTP request, I stop the timer, and then I create a new one.
bool timeriststopped=false;
void stoppTimer(){
if(timeriststopped)return;
timeriststopped=true;
matrix.black(); //or disable display?
matrix.update();
timerDetachInterrupt(displayUpdateTimer);
timerStop(displayUpdateTimer);
timerAlarmDisable(displayUpdateTimer);//
timerEnd(displayUpdateTimer);
displayUpdateTimer=NULL;
}
void startTimer(){
if(!timeriststopped)return;
displayUpdateTimer = timerBegin(0, 80, true);//id,divider,countUp, true=edge type
timerAttachInterrupt(displayUpdateTimer, &onDisplayUpdate, true);//timer,function,
timerAlarmWrite(displayUpdateTimer, 2, true);//2 *timer,interruptAt,autoreload
timerAlarmEnable(displayUpdateTimer);
timeriststopped=false;
}
edit: add checks
Great! I can not test it now
I was able to further encircle my problem "Core panic'ed/blocked wifi Task", the task gets stuck when I want to read a character via SPIFFS and the timer is running. If I stop the timer here, everything's okay.
i have upload my Projekt to: https://github.com/polygontwist/ESP32_32x32RGBMatrix/
i did not get the example to run together with wifi, OTA etc.. timerAttachInterrupt blocks wifi. My solution:
stop Task when upload OTA: