Add Serial Nr into log

This commit is contained in:
Phat Nguyen
2024-02-17 12:11:44 +07:00
parent 7c1eae83e4
commit 7c63af5ba9
3 changed files with 16 additions and 0 deletions

View File

@@ -376,6 +376,7 @@ static void sendDataToServer(void);
static void dispHandler(void); static void dispHandler(void);
static String getDevId(void); static String getDevId(void);
static void updateWiFiConnect(void); static void updateWiFiConnect(void);
static void showNr(void);
AgSchedule configSchedule(SERVER_CONFIG_UPDATE_INTERVAL, serverConfigPoll); AgSchedule configSchedule(SERVER_CONFIG_UPDATE_INTERVAL, serverConfigPoll);
AgSchedule serverSchedule(SERVER_SYNC_INTERVAL, sendDataToServer); AgSchedule serverSchedule(SERVER_SYNC_INTERVAL, sendDataToServer);
@@ -386,6 +387,7 @@ AgSchedule tempHumSchedule(SENSOR_TEMP_HUM_UPDATE_INTERVAL, tempHumPoll);
void setup() { void setup() {
Serial.begin(115200); Serial.begin(115200);
showNr();
/** Init I2C */ /** Init I2C */
Wire.begin(ag.getI2cSdaPin(), ag.getI2cSclPin()); Wire.begin(ag.getI2cSdaPin(), ag.getI2cSclPin());
@@ -665,6 +667,10 @@ static void updateWiFiConnect(void) {
} }
} }
static void showNr(void) {
Serial.println("Serial nr: " + getDevId());
}
String getNormalizedMac() { String getNormalizedMac() {
String mac = WiFi.macAddress(); String mac = WiFi.macAddress();
mac.replace(":", ""); mac.replace(":", "");

View File

@@ -475,6 +475,7 @@ static void pmPoll(void);
static void sendDataToServer(void); static void sendDataToServer(void);
static void tempHumPoll(void); static void tempHumPoll(void);
static void co2Poll(void); static void co2Poll(void);
static void showNr(void);
/** Init schedule */ /** Init schedule */
AgSchedule dispLedSchedule(DISP_UPDATE_INTERVAL, updateDispLedBar); AgSchedule dispLedSchedule(DISP_UPDATE_INTERVAL, updateDispLedBar);
@@ -488,6 +489,7 @@ AgSchedule tvocSchedule(SENSOR_TVOC_UPDATE_INTERVAL, tvocPoll);
void setup() { void setup() {
/** Serial fore print debug message */ /** Serial fore print debug message */
Serial.begin(115200); Serial.begin(115200);
showNr();
/** Init I2C */ /** Init I2C */
Wire.begin(ag.getI2cSdaPin(), ag.getI2cSclPin()); Wire.begin(ag.getI2cSdaPin(), ag.getI2cSclPin());
@@ -646,6 +648,10 @@ static void co2Poll(void) {
Serial.printf("CO2 index: %d\r\n", co2Ppm); Serial.printf("CO2 index: %d\r\n", co2Ppm);
} }
static void showNr(void) {
Serial.println("Serial nr: " + getDevId());
}
static void sendPing() { static void sendPing() {
JSONVar root; JSONVar root;
root["wifi"] = WiFi.RSSI(); root["wifi"] = WiFi.RSSI();

View File

@@ -458,6 +458,7 @@ static void sendDataToServer(void);
static void co2Poll(void); static void co2Poll(void);
static void serverConfigPoll(void); static void serverConfigPoll(void);
static const char *getFwMode(int mode); static const char *getFwMode(int mode);
static void showNr(void);
AgSchedule configSchedule(SERVER_CONFIG_UPDATE_INTERVAL, serverConfigPoll); AgSchedule configSchedule(SERVER_CONFIG_UPDATE_INTERVAL, serverConfigPoll);
AgSchedule serverSchedule(SERVER_SYNC_INTERVAL, sendDataToServer); AgSchedule serverSchedule(SERVER_SYNC_INTERVAL, sendDataToServer);
@@ -467,6 +468,7 @@ AgSchedule tvocSchedule(SENSOR_TVOC_UPDATE_INTERVAL, tvocPoll);
void setup() { void setup() {
Serial.begin(115200); Serial.begin(115200);
showNr();
/** Board init */ /** Board init */
boardInit(); boardInit();
@@ -978,3 +980,5 @@ static const char *getFwMode(int mode) {
} }
return "FW_MODE_UNKNOW"; return "FW_MODE_UNKNOW";
} }
static void showNr(void) { Serial.println("Serial nr: " + getDevId()); }