EEPROM SmallRoom
This commit is contained in:
@@ -15,7 +15,7 @@ framework = arduino
|
|||||||
board_build.ldscript = eagle.flash.1m.ld
|
board_build.ldscript = eagle.flash.1m.ld
|
||||||
board_build.f_cpu = 26000000L
|
board_build.f_cpu = 26000000L
|
||||||
upload_protocol = espota
|
upload_protocol = espota
|
||||||
upload_port = 192.168.1.7
|
upload_port = 192.168.1.148
|
||||||
lib_deps =
|
lib_deps =
|
||||||
Adafruit HTU21DF Library @ ^1.1.0
|
Adafruit HTU21DF Library @ ^1.1.0
|
||||||
PubSubClient @ ^2.8
|
PubSubClient @ ^2.8
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ unsigned long cRun;
|
|||||||
int minCnt = 0;
|
int minCnt = 0;
|
||||||
int measCnt = 1;
|
int measCnt = 1;
|
||||||
uint8_t mv, oldmv;
|
uint8_t mv, oldmv;
|
||||||
int adc, oldadc, delta;
|
uint16_t adc, oldadc, delta;
|
||||||
|
|
||||||
void reconnect();
|
void reconnect();
|
||||||
void publishMin();
|
void publishMin();
|
||||||
@@ -205,7 +205,7 @@ void publishSec()
|
|||||||
client.publish("/hometest/smallroom/millis", strFVal);
|
client.publish("/hometest/smallroom/millis", strFVal);
|
||||||
ltoa(adc, strFVal, 10);
|
ltoa(adc, strFVal, 10);
|
||||||
client.publish("/hometest/smallroom/light", strFVal);
|
client.publish("/hometest/smallroom/light", strFVal);
|
||||||
ultoa(delta, strFVal, 10);
|
itoa(delta, strFVal, 10);
|
||||||
client.publish("/hometest/smallroom/ldelta", strFVal);
|
client.publish("/hometest/smallroom/ldelta", strFVal);
|
||||||
//digitalWrite(LED_GREEN, LOW);
|
//digitalWrite(LED_GREEN, LOW);
|
||||||
}
|
}
|
||||||
@@ -213,7 +213,9 @@ void publishSec()
|
|||||||
|
|
||||||
void callback(char* topic, byte* payload, unsigned int length) {
|
void callback(char* topic, byte* payload, unsigned int length) {
|
||||||
if(strcmp(topic,"/home/smallroom/ldelta") == 0){
|
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.put(0, delta);
|
||||||
EEPROM.commit();
|
EEPROM.commit();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user