-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Send data or alerts to Telegram Messenger chat #442
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,7 +37,7 @@ | |
|
||
// DIP switches | ||
static Switches switches; | ||
|
||
float accumulated_Count_Rate = 0.0, accumulated_Dose_Rate = 0.0; | ||
|
||
void setup() { | ||
bool isLoraBoard = init_hwtest(); | ||
|
@@ -107,14 +107,13 @@ int update_ble_status(void) { // currently no error detection | |
} | ||
|
||
void publish(unsigned long current_ms, unsigned long current_counts, unsigned long gm_count_timestamp, unsigned long current_hv_pulses, | ||
float temperature, float humidity, float pressure) { | ||
bool have_thp, float temperature, float humidity, float pressure, int wifi_status) { | ||
static unsigned long last_timestamp = millis(); | ||
static unsigned long last_counts = 0; | ||
static unsigned long last_hv_pulses = 0; | ||
static unsigned long last_count_timestamp = 0; | ||
static unsigned int accumulated_GMC_counts = 0; | ||
static unsigned long accumulated_time = 0; | ||
static float accumulated_Count_Rate = 0.0, accumulated_Dose_Rate = 0.0; | ||
|
||
if (((current_counts - last_counts) >= MINCOUNTS) || ((current_ms - last_timestamp) >= DISPLAYREFRESH)) { | ||
if ((gm_count_timestamp == 0) && (last_count_timestamp == 0)) { | ||
|
@@ -149,13 +148,21 @@ void publish(unsigned long current_ms, unsigned long current_counts, unsigned lo | |
(showDisplay && switches.display_on)); | ||
|
||
// Sound local alarm? | ||
if (soundLocalAlarm && GMC_factor_uSvph > 0) { | ||
if (accumulated_Dose_Rate > localAlarmThreshold) { | ||
log(WARNING, "Local alarm: Accumulated dose of %.3f µSv/h above threshold at %.3f µSv/h", accumulated_Dose_Rate, localAlarmThreshold); | ||
alarm(); | ||
} else if (Dose_Rate > (accumulated_Dose_Rate * localAlarmFactor)) { | ||
log(WARNING, "Local alarm: Current dose of %.3f > %d x accumulated dose of %.3f µSv/h", Dose_Rate, localAlarmFactor, accumulated_Dose_Rate); | ||
alarm(); | ||
if ((soundLocalAlarm || sendLocalAlarmToMessenger) && GMC_factor_uSvph > 0) { | ||
if ((accumulated_Dose_Rate > localAlarmThreshold) || (Dose_Rate > (accumulated_Dose_Rate * localAlarmFactor))) { | ||
if (accumulated_Dose_Rate > localAlarmThreshold) { | ||
log(WARNING, "Local alarm: Accumulated dose of %.3f µSv/h above threshold at %.3f µSv/h", accumulated_Dose_Rate, localAlarmThreshold); | ||
} else { | ||
log(WARNING, "Local alarm: Current dose of %.3f > %d x accumulated dose of %.3f µSv/h", Dose_Rate, localAlarmFactor, accumulated_Dose_Rate); | ||
} | ||
if (soundLocalAlarm) { | ||
alarm(); | ||
} | ||
if (sendLocalAlarmToMessenger) { | ||
transmit_userinfo(tubes[TUBE_TYPE].type, tubes[TUBE_TYPE].nbr, tubes[TUBE_TYPE].cps_to_uSvph, | ||
(unsigned int)(Count_Rate * 60), (unsigned int)(accumulated_Count_Rate * 60), accumulated_Dose_Rate, | ||
have_thp, temperature, humidity, pressure, wifi_status, true); | ||
} | ||
} | ||
} | ||
|
||
|
@@ -236,8 +243,12 @@ void transmit(unsigned long current_ms, unsigned long current_counts, unsigned l | |
|
||
log(DEBUG, "Measured GM: cpm= %d HV=%d", current_cpm, hv_pulses); | ||
|
||
transmit_data(tubes[TUBE_TYPE].type, tubes[TUBE_TYPE].nbr, dt, hv_pulses, counts, current_cpm, | ||
transmit_data(tubes[TUBE_TYPE].type, tubes[TUBE_TYPE].nbr, | ||
dt, hv_pulses, counts, current_cpm, | ||
Comment on lines
-239
to
+247
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. was this beyond some line length limit or why did you reformat this? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. maybe wordwrap from my editor? will check |
||
have_thp, temperature, humidity, pressure, wifi_status); | ||
transmit_userinfo(tubes[TUBE_TYPE].type, tubes[TUBE_TYPE].nbr, tubes[TUBE_TYPE].cps_to_uSvph, | ||
current_cpm, accumulated_Count_Rate, accumulated_Dose_Rate, | ||
have_thp, temperature, humidity, pressure, wifi_status, false); | ||
} | ||
} | ||
|
||
|
@@ -283,7 +294,7 @@ void loop() { | |
// do any other periodic updates for uplinks | ||
poll_transmission(); | ||
|
||
publish(current_ms, gm_counts, gm_count_timestamp, hv_pulses, temperature, humidity, pressure); | ||
publish(current_ms, gm_counts, gm_count_timestamp, hv_pulses, have_thp, temperature, humidity, pressure, wifi_status); | ||
|
||
if (Serial_Print_Mode == Serial_One_Minute_Log) | ||
one_minute_log(current_ms, gm_counts); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,7 @@ | |
#include <Arduino.h> | ||
#include <WiFiClientSecure.h> | ||
#include <HTTPClient.h> | ||
#include <UniversalTelegramBot.h> | ||
|
||
#include "log.h" | ||
#include "display.h" | ||
|
@@ -41,7 +42,8 @@ typedef struct https_client { | |
HTTPClient *hc; | ||
} HttpsClient; | ||
|
||
static HttpsClient c_madavi, c_sensorc, c_customsrv; | ||
static HttpsClient c_madavi, c_sensorc, c_customsrv, c_telegram; | ||
UniversalTelegramBot *telegram_bot; | ||
|
||
void setup_transmission(const char *version, char *ssid, bool loraHardware) { | ||
chipID = String(ssid); | ||
|
@@ -69,9 +71,22 @@ void setup_transmission(const char *version, char *ssid, bool loraHardware) { | |
c_customsrv.wc->setCACert(ca_certs); | ||
c_customsrv.hc = new HTTPClient; | ||
|
||
if ((strlen(telegramBotToken) < 40) || (strlen(telegramChatId) < 7)) | ||
sendDataToMessengerEvery = -1; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. maybe "Interval" instead of "Every"? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. s. above |
||
|
||
c_telegram.wc = new WiFiClientSecure; | ||
c_telegram.wc->setCACert(TELEGRAM_CERTIFICATE_ROOT); | ||
c_telegram.hc = new HTTPClient; | ||
|
||
if (sendDataToMessengerEvery >= 0) { | ||
log(DEBUG, "Starting Telegram Bot..."); | ||
telegram_bot = new UniversalTelegramBot(telegramBotToken, *(c_telegram.wc)); | ||
} | ||
|
||
set_status(STATUS_SCOMM, sendToCommunity ? ST_SCOMM_INIT : ST_SCOMM_OFF); | ||
set_status(STATUS_MADAVI, sendToMadavi ? ST_MADAVI_INIT : ST_MADAVI_OFF); | ||
set_status(STATUS_TTN, sendToLora ? ST_TTN_INIT : ST_TTN_OFF); | ||
set_status(STATUS_TELEGRAM, (sendDataToMessengerEvery >= 0) ? ST_TELEGRAM_INIT : ST_TELEGRAM_OFF); | ||
} | ||
|
||
void poll_transmission() { | ||
|
@@ -142,7 +157,7 @@ int send_http_geiger(HttpsClient *client, const char *host, unsigned int timedif | |
int send_http_thp(HttpsClient *client, const char *host, float temperature, float humidity, float pressure, int xpin) { | ||
char body[1000]; | ||
prepare_http(client, host); | ||
if(xpin != XPIN_NO_XPIN) { | ||
if (xpin != XPIN_NO_XPIN) { | ||
client->hc->addHeader("X-PIN", String(xpin)); | ||
} | ||
const char *json_format = R"=====( | ||
|
@@ -257,7 +272,7 @@ void transmit_data(String tube_type, int tube_nbr, unsigned int dt, unsigned int | |
log(INFO, "Sent to CUSTOMSRV, status: %s, http: %d %d", customsrv_ok ? "ok" : "error", rc1, rc2); | ||
#endif | ||
|
||
if(sendToMadavi && (wifi_status == ST_WIFI_CONNECTED)) { | ||
if (sendToMadavi && (wifi_status == ST_WIFI_CONNECTED)) { | ||
bool madavi_ok; | ||
log(INFO, "Sending to Madavi ..."); | ||
set_status(STATUS_MADAVI, ST_MADAVI_SENDING); | ||
|
@@ -271,7 +286,7 @@ void transmit_data(String tube_type, int tube_nbr, unsigned int dt, unsigned int | |
display_status(); | ||
} | ||
|
||
if(sendToCommunity && (wifi_status == ST_WIFI_CONNECTED)) { | ||
if (sendToCommunity && (wifi_status == ST_WIFI_CONNECTED)) { | ||
bool scomm_ok; | ||
log(INFO, "Sending to sensor.community ..."); | ||
set_status(STATUS_SCOMM, ST_SCOMM_SENDING); | ||
|
@@ -285,7 +300,7 @@ void transmit_data(String tube_type, int tube_nbr, unsigned int dt, unsigned int | |
display_status(); | ||
} | ||
|
||
if(isLoraBoard && sendToLora && (strcmp(appeui, "") != 0)) { // send only, if we have LoRa credentials | ||
if (isLoraBoard && sendToLora && (strcmp(appeui, "") != 0)) { // send only, if we have LoRa credentials | ||
bool ttn_ok; | ||
log(INFO, "Sending to TTN ..."); | ||
set_status(STATUS_TTN, ST_TTN_SENDING); | ||
|
@@ -296,5 +311,59 @@ void transmit_data(String tube_type, int tube_nbr, unsigned int dt, unsigned int | |
set_status(STATUS_TTN, ttn_ok ? ST_TTN_IDLE : ST_TTN_ERROR); | ||
display_status(); | ||
} | ||
|
||
} | ||
|
||
void transmit_userinfo(String tube_type, int tube_nbr, float tube_factor, unsigned int cpm, unsigned int accu_cpm, float accu_rate, | ||
int have_thp, float temperature, float humidity, float pressure, int wifi_status, bool alarm_status) { | ||
Comment on lines
+317
to
+318
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. indenting seems not adjusted. int directly below String? |
||
|
||
if (wifi_status != ST_WIFI_CONNECTED) | ||
return; | ||
|
||
// if we don't have a valid Messenger config, do not send to Messenger | ||
if (sendDataToMessengerEvery < 0) | ||
return; | ||
Comment on lines
+323
to
+325
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. either remove the empty line 322 or add another empty line after 325 to get consistent? |
||
// in case the config has been changed in the meantime | ||
if ((strlen(telegramBotToken) < 40) || (strlen(telegramChatId) < 7)) { | ||
sendDataToMessengerEvery = -1; | ||
return; | ||
} | ||
|
||
static unsigned int transmitCounter = 0; | ||
transmitCounter++; | ||
if (transmitCounter == 27720) transmitCounter = 0; // 27720 % 1..12 == 0 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. not sure i understand... There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Aim was for the first numbers (i.e. 1 to 12) to avoid an hiccup (i.e. change in interval length) when the counter rolls over. As the actual time the sending is happening is slowly shifting anyway, it probably doesn't matter... There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i still don't understand. and you need to add the comment to the source code, not here on github or in a year nobody will remember why we have that. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. will adapt to fixed interval after #444 |
||
|
||
char localEspId[16]; | ||
char thp_text[60]; | ||
|
||
chipID.toCharArray(localEspId, sizeof(localEspId)); | ||
if (have_thp) { | ||
sprintf(thp_text, "\nBME data: %.1fC %.1f%% %.1fhPa", temperature, humidity, pressure/100); | ||
} | ||
|
||
if (((sendDataToMessengerEvery > 0) && (transmitCounter % sendDataToMessengerEvery == 0)) | ||
|| ((sendDataToMessengerEvery >= 0) && alarm_status)) { | ||
Comment on lines
+344
to
+345
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this seems to be a triple use variable / in band signalling and that's bad:
can we have different variables to make it better readable / configurable? e.g. could be one for the interval and another one for the mode (disabled, always, only on alarm). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. that would maybe also solve the use case "send in intervals of N" but "only when alarm is on". |
||
bool telegram_ok; | ||
char message[120]; | ||
log(INFO, "Sending to Telegram messenger ..."); | ||
set_status(STATUS_TELEGRAM, ST_TELEGRAM_SENDING); | ||
display_status(); | ||
if (alarm_status) { | ||
if (tube_nbr > 0) | ||
sprintf(message, "<b>--- MULTIGEIGER ALERT ! ---</b>\n<code>%s</code> rate too high:\n%.2f nSv/h (accumulated: %.2f nSv/h)", localEspId, cpm*tube_factor*1000/60, accu_rate*1000); | ||
else | ||
sprintf(message, "<b>--- MULTIGEIGER ALERT ! ---</b>\n<code>%s</code> rate too high:\n%d (accumulated: %d)", localEspId, cpm, accu_cpm); | ||
Comment on lines
+353
to
+355
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. no blank before the exclamation mark. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. still todo. also: the unit of measurement is missing for the lower case. "GM counts"? |
||
} else { | ||
if (tube_nbr > 0) | ||
sprintf(message, "MultiGeiger <code>%s</code> rates:\n%.2f nSv/h (accumulated: %.2f nSv/h)%s", localEspId, cpm*tube_factor*1000/60, accu_rate*1000, have_thp ? thp_text : ""); | ||
else | ||
sprintf(message, "MultiGeiger <code>%s</code> CPM:\n%d (accumulated: %d)%s", localEspId, cpm, accu_cpm, have_thp ? thp_text : ""); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same here. |
||
} | ||
telegram_ok = telegram_bot->sendMessage(telegramChatId, message, "HTML"); | ||
log(INFO, "Sent to Telegram messenger, status: %s", telegram_ok ? "ok" : "error"); | ||
set_status(STATUS_TELEGRAM, telegram_ok ? ST_TELEGRAM_IDLE : ST_TELEGRAM_ERROR); | ||
display_status(); | ||
ThomasWaldmann marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
|
||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -82,3 +82,25 @@ | |
// If current dose rate rises to (default) 3 times the accumulated dose rate, i.e. 0.3 µSv/h, trigger the local alarm. | ||
// ! Requires a valid tube type to be set in order to calculate dose rate. | ||
#define LOCAL_ALARM_FACTOR 3 // current / accumulated dose rate | ||
|
||
// Send MultiGeiger info and alerts to Messaging services. Currently supported: | ||
// - Telegram Messenger | ||
// REQUIRES WIFI CONNECTION! | ||
// Update via Messenger every N sensor.community messages (default 150 s / 2.5 min). | ||
// Set to 0 to disable normal data transfer. | ||
// 24 = 1/hour, 576 = 1/day, 4032 = 1/week, max: 27719 (~48 days) | ||
#define SEND_DATA_TO_MESSENGER_EVERY 0 | ||
|
||
// Send local alerts via supported Messenger services. | ||
// See above for more info on local alerts. | ||
#define SEND_LOCAL_ALARM_TO_MESSENGER true | ||
|
||
///// TELEGRAM MESSENGER | ||
// To communicate with the Telegram Messenger on your phone you need to create a bot. | ||
// Starting point: https://core.telegram.org/bots | ||
// You will get a Bot token, please provide this via Web Config. | ||
// Form: "XXXXXXXXXX:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" | ||
// Important: Start your bot channel with the command "/start" and receive the Chat ID. | ||
// In order to get MultiGeiger messages to your specific chat, please provide this Chat ID via Web Config. | ||
// Form: "123456789" | ||
Comment on lines
+99
to
+105
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. shouldn't this be either in the form the user will see or in the documentation? |
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,6 +40,13 @@ static bool isLoraBoard; | |
float localAlarmThreshold = LOCAL_ALARM_THRESHOLD; | ||
int localAlarmFactor = (int)LOCAL_ALARM_FACTOR; | ||
|
||
int sendDataToMessengerEvery = (int)SEND_DATA_TO_MESSENGER_EVERY; | ||
bool sendLocalAlarmToMessenger = SEND_LOCAL_ALARM_TO_MESSENGER; | ||
char telegramBotToken[50] = ""; // "XXXXXXXXXX:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" | ||
char telegramChatId[12] = ""; // "1234567890" | ||
|
||
char sendLocalAlarmToMessenger_c[CHECKBOX_LEN]; | ||
|
||
iotwebconf::ParameterGroup grpMisc = iotwebconf::ParameterGroup("misc", "Misc. Settings"); | ||
iotwebconf::CheckboxParameter startSoundParam = iotwebconf::CheckboxParameter("Start sound", "startSound", playSound_c, CHECKBOX_LEN, playSound); | ||
iotwebconf::CheckboxParameter speakerTickParam = iotwebconf::CheckboxParameter("Speaker tick", "speakerTick", speakerTick_c, CHECKBOX_LEN, speakerTick); | ||
|
@@ -57,7 +64,7 @@ iotwebconf::TextParameter deveuiParam = iotwebconf::TextParameter("DEVEUI", "dev | |
iotwebconf::TextParameter appeuiParam = iotwebconf::TextParameter("APPEUI", "appeui", appeui, 17); | ||
iotwebconf::TextParameter appkeyParam = iotwebconf::TextParameter("APPKEY", "appkey", appkey, 33); | ||
|
||
iotwebconf::ParameterGroup grpAlarm = iotwebconf::ParameterGroup("alarm", "Local Alarm Setting"); | ||
iotwebconf::ParameterGroup grpAlarm = iotwebconf::ParameterGroup("alarm", "Local Alarm Settings"); | ||
iotwebconf::CheckboxParameter soundLocalAlarmParam = iotwebconf::CheckboxParameter("Enable local alarm sound", "soundLocalAlarm", soundLocalAlarm_c, CHECKBOX_LEN, soundLocalAlarm); | ||
iotwebconf::FloatTParameter localAlarmThresholdParam = | ||
iotwebconf::Builder<iotwebconf::FloatTParameter>("localAlarmThreshold"). | ||
|
@@ -71,6 +78,18 @@ iotwebconf::IntTParameter<int16_t> localAlarmFactorParam = | |
min(2).max(100). | ||
step(1).placeholder("2..100").build(); | ||
|
||
iotwebconf::ParameterGroup grpMessenger = iotwebconf::ParameterGroup("messenger", "Messenger Settings"); | ||
iotwebconf::CheckboxParameter sendLocalAlarmToMessengerParam = iotwebconf::CheckboxParameter("Send local alarm via Messenger", "sendLocalAlarmToMessenger", sendLocalAlarmToMessenger_c, CHECKBOX_LEN, sendLocalAlarmToMessenger); | ||
iotwebconf::IntTParameter<int16_t> sendDataToMessengerEveryParam = | ||
iotwebconf::Builder<iotwebconf::IntTParameter<int16_t>>("sendDataToMessengerEvery"). | ||
label("Send data via Messenger every N x 2.5min\n(0=never,24=1/h,576=1/d,4032=1/week,max:27719)"). | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. hardcoding this would need that we remember to change this place if we ever change the 2.5min elsewhere. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Agreed. We need a better architecture for data processing handling... s. above There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. you can also write here "every N measurement intervals" or so and that solves this problem. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. with that, one can't give specific values for 1/h, 1/d, 1/w though. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. s. above |
||
defaultValue(sendDataToMessengerEvery). | ||
min(0).max(27719). | ||
step(1).placeholder("0..27719").build(); | ||
iotwebconf::PasswordParameter telegramBotTokenParam = iotwebconf::PasswordParameter("Telegram Bot Token (Reboot required!)", "telegramBotToken", telegramBotToken, 50); | ||
iotwebconf::PasswordParameter telegramChatIdParam = iotwebconf::PasswordParameter("Telegram Chat ID", "telegramChatId", telegramChatId, 12); | ||
|
||
|
||
// This only needs to be changed if the layout of the configuration is changed. | ||
// Appending new variables does not require a new version number here. | ||
// If this value is changed, ALL configuration variables must be re-entered, | ||
|
@@ -162,6 +181,8 @@ void loadConfigVariables(void) { | |
soundLocalAlarm = soundLocalAlarmParam.isChecked(); | ||
localAlarmThreshold = localAlarmThresholdParam.value(); | ||
localAlarmFactor = localAlarmFactorParam.value(); | ||
sendDataToMessengerEvery = sendDataToMessengerEveryParam.value(); | ||
sendLocalAlarmToMessenger = sendLocalAlarmToMessengerParam.isChecked(); | ||
} | ||
|
||
void configSaved(void) { | ||
|
@@ -205,6 +226,11 @@ void setup_webconf(bool loraHardware) { | |
grpAlarm.addItem(&localAlarmThresholdParam); | ||
grpAlarm.addItem(&localAlarmFactorParam); | ||
iotWebConf.addParameterGroup(&grpAlarm); | ||
grpMessenger.addItem(&sendDataToMessengerEveryParam); | ||
grpMessenger.addItem(&sendLocalAlarmToMessengerParam); | ||
grpMessenger.addItem(&telegramBotTokenParam); | ||
grpMessenger.addItem(&telegramChatIdParam); | ||
iotWebConf.addParameterGroup(&grpMessenger); | ||
|
||
// if we don't have LoRa hardware, do not send to LoRa | ||
if (!isLoraBoard) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,3 +31,4 @@ lib_deps= | |
IotWebConf@^3.1.0 | ||
MCCI LoRaWAN LMIC library | ||
h2zero/NimBLE-Arduino | ||
witnessmenow/UniversalTelegramBot@^1.3.0 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is it required to fix it to that version? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is a bit dirty considering i just got rid of most of the global variables mess.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed. But it would be equally bad style to redo the whole dose calculation with local storage of the previous state from "publish" again in "transmit". I think it might be time to merge all the activities with dose & count stuff in a single function...? Maybe we should indeed meet e.g. at ShackSpace and refactor first on the whiteboard and then directly in code?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s. #444