Start a new topic

Nextion recvRetCommandFinished err watchdog

I have a project on the go that displays 64 values on the screen, I have reduced the send rate of the data so that touch events are not ignored, but I have a problem; while the values are changing a page change event caused by a touch is often lost by the mcu, my program still tries to send data to the screen and gets lots of recvRetCommandFinished err back.  


I have written a watchdog to cause a reset of the micro if it counts more than 5 of these errors, but this is a bit of a mess, ideally on error  it would instead return the correct page number and continue. Has anyone else had any experience of this ? 




grep the Iteadlib source for recvRetCommandFinished err

I would think there is little reason to reset a micro on any count

  but a successful non-err would or should reset the watchdog.


Calculating an estimate, or even measuring what actual byte usage is on serial.

 - such a long serial debug message ~ 25 bytes? still takes sequential time

   unless your MCU is multi-threaded multi-cored and multitasking


Changing a page

   Nextion dumps the current page from mem to load new loading page.

Program purposefully with this in mind


Page 0x66 Return Data

   will tell you what page is current

If the components you are sending to aren't on the current page

    it will make less sense to send to a non active page ... ?

Unless of course you create a scenario to accommodate such


If sending 64 values at once, most likely leading to buffer overloads


Dear experts, 


I have loaded the projects form the examples folder: CompText_v0_32.HMI into NX8048T050_011 and CompText_v0_32.ino into arduino mega R3. At the first look it works fine (I see the number increasing/decreasing after the touch), but when I open the arduino serial monitor get "recvRetCommandFinished err" after each command. Why? Thank you.


NexHardware.h/.cpp 

  - function recvRetCommandFinished()



 

bool recvRetCommandFinished(uint32_t timeout)
{    
    bool ret = false;
    uint8_t temp[4] = {0};
    
    nexSerial.setTimeout(timeout);
    if (sizeof(temp) != nexSerial.readBytes((char *)temp, sizeof(temp)))
    {
        ret = false;
    }

    if (temp[0] == NEX_RET_CMD_FINISHED
        && temp[1] == 0xFF
        && temp[2] == 0xFF
        && temp[3] == 0xFF
        )
    {
        ret = true;
    }

    if (ret) 
    {
        dbSerialPrintln("recvRetCommandFinished ok");
    }
    else
    {
        dbSerialPrintln("recvRetCommandFinished err");
    }
    
    return ret;
}

 


Login or Signup to post a comment