Skip to content

Commit

Permalink
period_min add to json, mqtt
Browse files Browse the repository at this point in the history
  • Loading branch information
dontsovcmc committed Feb 25, 2021
1 parent e31437f commit 3cb079b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
1 change: 1 addition & 0 deletions ESP8266/src/UserClass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ bool UserClass::sendNewData(const Settings &settings, const SlaveData &data, con
root["setuptime"] = settings.setup_time;
root["adc0"] = data.adc0;
root["adc1"] = data.adc1;
root["period_min"] = settings.wakeup_per_min;

serializeJson(root, jsonBody);
LOG_INFO(FPSTR(S_SND), "JSON size:\t" << jsonBody.length());
Expand Down
3 changes: 2 additions & 1 deletion ESP8266/src/sender_mqtt.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ bool send_mqtt(const Settings &sett, const SlaveData &data, const CalculatedData
client.publish((topic + "setuptime").c_str(), String(sett.setup_time).c_str(), true);
client.publish((topic + "adc0").c_str(), String(data.adc0).c_str(), true);
client.publish((topic + "adc1").c_str(), String(data.adc1).c_str(), true);

client.publish((topic + "period_min").c_str(), String(sett.wakeup_per_min).c_str(), true);

client.disconnect();
return true;
} else {
Expand Down
6 changes: 5 additions & 1 deletion ESP8266/src/setup.h
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,12 @@ struct Settings
uint32_t ip;
uint32_t gateway;
uint32_t mask;


/*
Период пробуждение для отправки данных, мин
*/
uint16_t wakeup_per_min;

/*
Зарезервируем кучу места, чтобы не писать конвертер конфигураций.
Будет актуально для On-the-Air обновлений
Expand Down

0 comments on commit 3cb079b

Please sign in to comment.