Jomelo / LCDMenuLib2

Create a tree menu. Use it with different lcd types / console output / ssh console.
MIT License
249 stars 46 forks source link

lcdmlib2 on ttgo lora32 oled v1 and modbus slave rtu #71

Closed loscorpione closed 1 year ago

loscorpione commented 3 years ago

Hi Nils I used his library previously and now I'm using version 2 on module ttgo lora32 oled v1 I had to make a modbus RTU slave and for that purpose I'm using Alexander Emelianov's library https://github.com/emelianov/modbus-esp8266 I tested the library with the attached example:

include

define REGN 10

define SLAVE_ID 1

ModbusRTU mb; void setup() { Serial.begin(9600, SERIAL_8N1);

if defined(ESP32) || defined(ESP8266)

mb.begin(&Serial);

else

mb.begin(&Serial); mb.setBaudrate(9600);

endif

mb.slave(SLAVE_ID); mb.addHreg(REGN); mb.Hreg(REGN, 100); } void loop() { mb.task(); yield(); }

the library works perfectly but if I insert it in the scketch with the lcdmlib2 I have continuous restarts of the program. I found that this happens by putting this part in the void loop

void loop() { // this function must called here, do not delete it LCDML.loop(); mb.task(); yield(); }

I suppose I'm entering

mb.task(); yield();

in the wrong place Could you show me the correct way? i don't know how to fix this congratulations for the great work you have done with this library

ciao !!!

Jomelo commented 3 years ago

Hello, you need here a systematic troubleshooting for this restart. Please check the following things:

ciao

loscorpione commented 3 years ago

Thanks for your interest