RTC weirdness, why ?
Posted: Sat Jan 09, 2016 5:08 pm
Hi,
I have following code :
I have this output:
As you can see readin rtcStore is returning 0 and that i don't understand. If i remove all the write/read code for trial variable then i can read rtcStore, it's like i am doing something wrong when i write trial but it works.
Any ideas ?
/donnib
I have following code :
Code: Select all
#include "ESP8266WiFi.h"
extern "C" {
#include <user_interface.h>
}
byte rtcStore[1];
char trial[] = "[{\"T\":\"20\",\"H\":\"40\"},{\"T\":\"20\",\"H\":\"40\"},{\"T\":\"20\",\"H\":\"40\"},{\"T\":\"20\",\"H\":\"40\"},{\"T\":\"20\",\"H\":\"40\"},{\"T\":\"20\",\"H\":\"40\"},{\"T\":\"20\",\"H\":\"40\"},{\"T\":\"20\",\"H\":\"40\"},{\"T\":\"20\",\"H\":\"40\"},{\"T\":\"20\",\"H\":\"40\"}]";
void setup() {
// Start Serial
Serial.begin(115200);
delay(10);
Serial.println("Hello");
// put your setup code here, to run once:
}
void loop() {
delay(1000);
rtcStore[0] = 10;
Serial.println("Mem write rtcStore:");
Serial.println(system_rtc_mem_write(65, rtcStore, sizeof(rtcStore)));
Serial.println("Mem write trial:");
Serial.println(system_rtc_mem_write(68, trial, sizeof(trial)));
char t[sizeof(trial)];
byte r[1];
Serial.println("Mem read rtcStore:");
Serial.println(system_rtc_mem_read(65, &r, sizeof(r)));
Serial.println("Mem read trial:");
Serial.println(system_rtc_mem_read(68, &t, sizeof(trial)));
Serial.print('<');
Serial.print(t);
Serial.println('>');
Serial.print('<');
Serial.print(r[0]);
Serial.println('>');
}
I have this output:
Code: Select all
r...lrß.#.ânÀ.à....ì.p|ß.ìx.Çäl.p...ònnä.;ònÄä...bcl`.$`.üpònàÃÜ..àÇÀl....bÀ.nâãnÀ$Ø.bÀÄ>~ònî.ÄÁ.l`.ü.Ü#nÀ..r....nrß;.ÄÀ.?.r...rßÛnÀ..àÇÄl`.üünÄbàHello
Mem write rtcStore:
1
Mem write trial:
1
Mem read rtcStore:
0
Mem read trial:
1
<[{"T":"20","H":"40"},{"T":"20","H":"40"},{"T":"20","H":"40"},{"T":"20","H":"40"},{"T":"20","H":"40"},{"T":"20","H":"40"},{"T":"20","H":"40"},{"T":"20","H":"40"},{"T":"20","H":"40"},{"T":"20","H":"40"}]>
<0>
As you can see readin rtcStore is returning 0 and that i don't understand. If i remove all the write/read code for trial variable then i can read rtcStore, it's like i am doing something wrong when i write trial but it works.
Any ideas ?
/donnib