EEPROM SmallRoom
This commit is contained in:
@@ -32,7 +32,7 @@ unsigned long cRun;
|
||||
int minCnt = 0;
|
||||
int measCnt = 1;
|
||||
uint8_t mv, oldmv;
|
||||
int adc, oldadc, delta;
|
||||
uint16_t adc, oldadc, delta;
|
||||
|
||||
void reconnect();
|
||||
void publishMin();
|
||||
@@ -205,7 +205,7 @@ void publishSec()
|
||||
client.publish("/hometest/smallroom/millis", strFVal);
|
||||
ltoa(adc, strFVal, 10);
|
||||
client.publish("/hometest/smallroom/light", strFVal);
|
||||
ultoa(delta, strFVal, 10);
|
||||
itoa(delta, strFVal, 10);
|
||||
client.publish("/hometest/smallroom/ldelta", strFVal);
|
||||
//digitalWrite(LED_GREEN, LOW);
|
||||
}
|
||||
@@ -213,7 +213,9 @@ void publishSec()
|
||||
|
||||
void callback(char* topic, byte* payload, unsigned int length) {
|
||||
if(strcmp(topic,"/home/smallroom/ldelta") == 0){
|
||||
delta = atoi((char*)payload);
|
||||
payload[length] = '\0';
|
||||
String pl = String((char*)payload);
|
||||
delta = pl.toInt();// atoi((char*)payload);
|
||||
EEPROM.put(0, delta);
|
||||
EEPROM.commit();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user