Req V_FORECAST with arduino 1.8.6



  • Hello! - Me again! 😉

    I am trying to get a node to get data on node power up from the controller - I am sure it worked just a week or two ago, but now I cannot get it to work properly. The only thing that changed is update from arduino IDE 1.8.5 to 1.8.6.

    Here are the bits of the code that you'll want to see and maybe I have missed something whilst refining the code....

    ...init....
    #define CHILD_ID_GETFORECAST 4
    ......message....
    MyMessage msgGetForecast(CHILD_ID_GETFORECAST, V_FORECAST);
    ......presentation....
    present(CHILD_ID_GETFORECAST, S_BARO, "Forecast", true);
    .....request data.....
     request(CHILD_ID_GETFORECAST, V_FORECAST);
    .....receive function.....
    void receive(const MyMessage &message) {
       if (message.type == V_FORECAST) {
        forecast = (message.getString());
       }
        if (forecast == "stable"){
        Index = 0;}
        else if (forecast == "sunny"){
        Index = 1;}
        else if (forecast == "cloudy"){
        Index = 2;}
        else if (forecast == "unstable"){
        Index = 3;}
        else if (forecast == "thunderstorm"){
        Index = 4;}
        else if (forecast == "unknown"){
        Index = 5;}
    }
    
    

    If I use the resources>action>send raw data I can send any of the possible states and it works fine, so the receive works, just does not get the data to start with. I have tried putting the request in the end of 'setup' as well as in 'loop' but it just doesn't want to work now.



  • @skywatch Can you check it in MyController resources log? Do you receive any request? Also, check it in MyController server log, is there any error reported?



  • @jkandasa Nothing in the server log - I will check with the resources log today -

    I will also make a little 'test node' just to test this out as it was working before. It works when I send data to it, but does not receive data on start up request. Weird!

    Thanks!



  • @skywatch

    add some wait statement before request(CHILD_ID_GETFORECAST, V_FORECAST);

    example:

    present(CHILD_ID_GETFORECAST, S_BARO, "Forecast", true);
    wait(200);
    
    request(CHILD_ID_GETFORECAST, V_FORECAST);
    wait(200);
    


  • @jkandasa There are already wait(100); between nrf sends, and big (1000+uF) capacitors to buffer energy for the send.

    I have made progress and sent you an email with my findings.


 

Suggested Topics

11
Online

406
Users

370
Topics

2.3k
Posts