ESP32 retain memory during sleep

For general Flowcode discussion that does not belong in the other sections.
Post Reply
MJU20
Posts: 337
http://meble-kuchenne.info.pl
Joined: Tue Dec 08, 2020 5:11 pm
Has thanked: 93 times
Been thanked: 67 times

ESP32 retain memory during sleep

Post by MJU20 »

In: https://flowcode.co.uk/forums/viewtopic ... 5660#p5660 the magnificent mister mnfisher posted an example of a Flowcode chart that retains data during deep sleep mode.

I've tested this and it works..
But I now want to use the function where data is stored during deepsleep but it doesn't compile.

The only change I did was to change the "flag" variable from local to global. And now it doesn't compile.

In different macro's in my program there are points that the ESP32 can put to (deep) sleep.
Before it goes "to bed" I want to write a variable tot the RTC memory and read it back as soon as the ESP awakes.

Because the ESP is put to sleep in different macro's, the writing to the RTC should be done in different macro's.
I've used a global variable to store before going to sleep.
Could this be the problem?

Code: Select all

                                                                                                   ~~~~~~~~~~^~~~
../main/esp-project.c:5877:12: warning: unused variable 'FCL_FLAG' [-Wunused-variable]
  // Payload = Payload + "&field2="
            ^~~~~~~~
../main/esp-project.c: In function 'app_main':
../main/esp-project.c:6148:2: error: 'FCL_FLAG' undeclared (first use in this function); did you mean 'FCV_FLAG'?
 
  ^       
  FCV_FLAG
../main/esp-project.c:6148:2: note: each undeclared identifier is reported only once for each function it appears in
../main/esp-project.c:6230:51: warning: passing argument 1 of 'FCD_05131_WLAN_ESP32__ConnectToSSID' discards 'volatile' qualifier from pointer target type [-Wdiscarded-qualifiers]
../main/esp-project.c:2485:55: note: expected 'MX_CHAR *' {aka 'char *'} but argument is of type 'volatile MX_CHAR *' {aka 'volatile char *'}
        :Returns : MX_UINT8
                                                       ^       
../main/esp-project.c:6230:91: warning: passing argument 3 of 'FCD_05131_WLAN_ESP32__ConnectToSSID' discards 'volatile' qualifier from pointer target type [-Wdiscarded-qualifiers]
../main/esp-project.c:2485:96: note: expected 'MX_CHAR *' {aka 'char *'} but argument is of type 'volatile MX_CHAR *' {aka 'volatile char *'}
        :Returns : MX_UINT8
                                                                                                ^      
../main/esp-project.c:6241:22: error: 'flag' undeclared (first use in this function); did you mean 'fmal'?
../main/esp-project.c:6269:84: warning: passing argument 3 of 'FCD_0a9d1_MQTT_Client1__Publish' discards 'volatile' qualifier from pointer target type [-Wdiscarded-qualifiers]
../main/esp-project.c:1128:94: note: expected 'MX_CHAR *' {aka 'char *'} but argument is of type 'volatile MX_CHAR *' {aka 'volatile char *'}
 
                                                                                              ^          
In file included from C:\ProgramData\MatrixTSL\FlowcodeV9\CAL\includes.c:53,

mnfisher
Valued Contributor
Posts: 1462
Joined: Wed Dec 09, 2020 9:37 pm
Has thanked: 136 times
Been thanked: 713 times

Re: ESP32 retain memory during sleep

Post by mnfisher »

Hi, looks like you need to change FCL_FLAG to FCV_FLAG somewhere? (In a C block)

Martin

MJU20
Posts: 337
Joined: Tue Dec 08, 2020 5:11 pm
Has thanked: 93 times
Been thanked: 67 times

Re: ESP32 retain memory during sleep

Post by MJU20 »

Thanks again Martin.

I've been searching for the problem quite long again.
The problem was well hidden. But I found it thanks to the magnificent Martin.

Post Reply