Add optional HX711 GUI

Add optional HX711 scale interface to web GUI demonstrating easy GUI plug-in
This commit is contained in:
Theo Arends 2018-10-21 16:30:05 +02:00
parent 86aa00d388
commit 3f4320b95d
25 changed files with 280 additions and 23 deletions

View File

@ -32,9 +32,9 @@ FUNC_RULES_PROCESS | x | 6.0.0 | x | | | Process spe
FUNC_SERIAL | x | | x | | x | Process serial data
FUNC_FREE_MEM | | | x | | | Show free memory for debugging
FUNC_BUTTON_PRESSED | x | 6.2.1.18 | x | | | When a button is pressed
FUNC_WEB_ADD_BUTTON | | 6.2.1.14 | x | | | Add a Configuration Button to GUI
FUNC_WEB_ADD_MAIN_BUTTON | | 6.2.1.14 | x | | | Add a main button to GUI
FUNC_WEB_ADD_HANDLER | | 6.2.1.14 | x | | | Add a webserver handler
FUNC_WEB_ADD_BUTTON | | 6.2.1.14 | x | x | | Add a Configuration Button to GUI
FUNC_WEB_ADD_MAIN_BUTTON | | 6.2.1.14 | x | x | | Add a main button to GUI
FUNC_WEB_ADD_HANDLER | | 6.2.1.14 | x | x | | Add a webserver handler
## Display Call back Ids
The following table lists all Callback Ids for a Display service.

View File

@ -1,6 +1,7 @@
/* 6.2.1.18 20181019
* Add more API callbacks and document API.md
* Add support for La Crosse TX20 Anemometer (#2654, #3146)
* Add optional HX711 scale interface to web GUI demonstrating easy GUI plug-in
*
* 6.2.1.17 20181017
* Enable updated non-blocking PubSubClient as default MQTT client

View File

@ -461,6 +461,13 @@
#define D_HX_CAL_REFERENCE "Load reference weigth"
#define D_HX_CAL_DONE "Calibrated"
#define D_HX_CAL_FAIL "Calibration failed"
#define D_RESET_HX711 "Reset Scale"
#define D_CONFIGURE_HX711 "Configure Scale"
#define D_HX711_PARAMETERS "Scale parameters"
#define D_ITEM_WEIGHT "Item weight"
#define D_REFERENCE_WEIGHT "Reference weigth"
#define D_CALIBRATE "Calibrate"
#define D_CALIBRATION "Calibration"
//xsns_35_tx20.ino
#define D_TX20_WIND_DIRECTION "Wind Direction"

View File

@ -461,6 +461,13 @@
#define D_HX_CAL_REFERENCE "Vložte referenční zátěž"
#define D_HX_CAL_DONE "Zkalibrováno"
#define D_HX_CAL_FAIL "Chyba kalibrace"
#define D_RESET_HX711 "Reset Scale"
#define D_CONFIGURE_HX711 "Configure Scale"
#define D_HX711_PARAMETERS "Scale parameters"
#define D_ITEM_WEIGHT "Item weight"
#define D_REFERENCE_WEIGHT "Reference weigth"
#define D_CALIBRATE "Calibrate"
#define D_CALIBRATION "Calibration"
//xsns_35_tx20.ino
#define D_TX20_WIND_DIRECTION "Směr větru"

View File

@ -461,6 +461,13 @@
#define D_HX_CAL_REFERENCE "Referenzgewicht auflegen"
#define D_HX_CAL_DONE "kalibriert"
#define D_HX_CAL_FAIL "Kalibrierung fehlgeschlagen"
#define D_RESET_HX711 "Reset Scale"
#define D_CONFIGURE_HX711 "Configure Scale"
#define D_HX711_PARAMETERS "Scale parameters"
#define D_ITEM_WEIGHT "Item weight"
#define D_REFERENCE_WEIGHT "Reference weigth"
#define D_CALIBRATE "Calibrate"
#define D_CALIBRATION "Calibration"
//xsns_35_tx20.ino
#define D_TX20_WIND_DIRECTION "Wind Direction"

View File

@ -461,6 +461,13 @@
#define D_HX_CAL_REFERENCE "Load reference weigth"
#define D_HX_CAL_DONE "Calibrated"
#define D_HX_CAL_FAIL "Calibration failed"
#define D_RESET_HX711 "Reset Scale"
#define D_CONFIGURE_HX711 "Configure Scale"
#define D_HX711_PARAMETERS "Scale parameters"
#define D_ITEM_WEIGHT "Item weight"
#define D_REFERENCE_WEIGHT "Reference weigth"
#define D_CALIBRATE "Calibrate"
#define D_CALIBRATION "Calibration"
//xsns_35_tx20.ino
#define D_TX20_WIND_DIRECTION "Wind Direction"

View File

@ -461,6 +461,13 @@
#define D_HX_CAL_REFERENCE "Load reference weigth"
#define D_HX_CAL_DONE "Calibrated"
#define D_HX_CAL_FAIL "Calibration failed"
#define D_RESET_HX711 "Reset Scale"
#define D_CONFIGURE_HX711 "Configure Scale"
#define D_HX711_PARAMETERS "Scale parameters"
#define D_ITEM_WEIGHT "Item weight"
#define D_REFERENCE_WEIGHT "Reference weigth"
#define D_CALIBRATE "Calibrate"
#define D_CALIBRATION "Calibration"
//xsns_35_tx20.ino
#define D_TX20_WIND_DIRECTION "Wind Direction"

View File

@ -461,6 +461,13 @@
#define D_HX_CAL_REFERENCE "Poner Peso de Referencia"
#define D_HX_CAL_DONE "Calibrado"
#define D_HX_CAL_FAIL "Falló Calibración"
#define D_RESET_HX711 "Reset Scale"
#define D_CONFIGURE_HX711 "Configure Scale"
#define D_HX711_PARAMETERS "Scale parameters"
#define D_ITEM_WEIGHT "Item weight"
#define D_REFERENCE_WEIGHT "Reference weigth"
#define D_CALIBRATE "Calibrate"
#define D_CALIBRATION "Calibration"
//xsns_35_tx20.ino
#define D_TX20_WIND_DIRECTION "Wind Direction"

View File

@ -461,6 +461,13 @@
#define D_HX_CAL_REFERENCE "Load reference weigth"
#define D_HX_CAL_DONE "Calibrated"
#define D_HX_CAL_FAIL "Calibration failed"
#define D_RESET_HX711 "Reset Scale"
#define D_CONFIGURE_HX711 "Configure Scale"
#define D_HX711_PARAMETERS "Scale parameters"
#define D_ITEM_WEIGHT "Item weight"
#define D_REFERENCE_WEIGHT "Reference weigth"
#define D_CALIBRATE "Calibrate"
#define D_CALIBRATION "Calibration"
//xsns_35_tx20.ino
#define D_TX20_WIND_DIRECTION "Wind Direction"

View File

@ -461,6 +461,13 @@
#define D_HX_CAL_REFERENCE "Load reference weigth"
#define D_HX_CAL_DONE "Calibrated"
#define D_HX_CAL_FAIL "Calibration failed"
#define D_RESET_HX711 "Reset Scale"
#define D_CONFIGURE_HX711 "Configure Scale"
#define D_HX711_PARAMETERS "Scale parameters"
#define D_ITEM_WEIGHT "Item weight"
#define D_REFERENCE_WEIGHT "Reference weigth"
#define D_CALIBRATE "Calibrate"
#define D_CALIBRATION "Calibration"
//xsns_35_tx20.ino
#define D_TX20_WIND_DIRECTION "Wind Direction"

View File

@ -461,6 +461,13 @@
#define D_HX_CAL_REFERENCE "Load reference weigth"
#define D_HX_CAL_DONE "Calibrated"
#define D_HX_CAL_FAIL "Calibration failed"
#define D_RESET_HX711 "Reset Scale"
#define D_CONFIGURE_HX711 "Configure Scale"
#define D_HX711_PARAMETERS "Scale parameters"
#define D_ITEM_WEIGHT "Item weight"
#define D_REFERENCE_WEIGHT "Reference weigth"
#define D_CALIBRATE "Calibrate"
#define D_CALIBRATION "Calibration"
//xsns_35_tx20.ino
#define D_TX20_WIND_DIRECTION "Wind Direction"

View File

@ -461,6 +461,13 @@
#define D_HX_CAL_REFERENCE "Load reference weigth"
#define D_HX_CAL_DONE "Calibrated"
#define D_HX_CAL_FAIL "Calibration failed"
#define D_RESET_HX711 "Reset Scale"
#define D_CONFIGURE_HX711 "Configure Scale"
#define D_HX711_PARAMETERS "Scale parameters"
#define D_ITEM_WEIGHT "Item weight"
#define D_REFERENCE_WEIGHT "Reference weigth"
#define D_CALIBRATE "Calibrate"
#define D_CALIBRATION "Calibration"
//xsns_35_tx20.ino
#define D_TX20_WIND_DIRECTION "Wind Direction"

View File

@ -461,6 +461,13 @@
#define D_HX_CAL_REFERENCE "Plaats ijkgewicht"
#define D_HX_CAL_DONE "Ge-ijkt"
#define D_HX_CAL_FAIL "Ijken is mislukt"
#define D_RESET_HX711 "Nulstelling weegschaal"
#define D_CONFIGURE_HX711 "Configureer Weegschaal"
#define D_HX711_PARAMETERS "Weegschaal parameters"
#define D_ITEM_WEIGHT "Gewicht van onderdeel"
#define D_REFERENCE_WEIGHT "Ijkgewicht"
#define D_CALIBRATE "Ijken"
#define D_CALIBRATION "Ijken"
//xsns_35_tx20.ino
#define D_TX20_WIND_DIRECTION "Windrichting"

View File

@ -461,6 +461,13 @@
#define D_HX_CAL_REFERENCE "Load reference weigth"
#define D_HX_CAL_DONE "Calibrated"
#define D_HX_CAL_FAIL "Calibration failed"
#define D_RESET_HX711 "Reset Scale"
#define D_CONFIGURE_HX711 "Configure Scale"
#define D_HX711_PARAMETERS "Scale parameters"
#define D_ITEM_WEIGHT "Item weight"
#define D_REFERENCE_WEIGHT "Reference weigth"
#define D_CALIBRATE "Calibrate"
#define D_CALIBRATION "Calibration"
//xsns_35_tx20.ino
#define D_TX20_WIND_DIRECTION "Wind Direction"

View File

@ -461,6 +461,13 @@
#define D_HX_CAL_REFERENCE "Load reference weigth"
#define D_HX_CAL_DONE "Calibrated"
#define D_HX_CAL_FAIL "Calibration failed"
#define D_RESET_HX711 "Reset Scale"
#define D_CONFIGURE_HX711 "Configure Scale"
#define D_HX711_PARAMETERS "Scale parameters"
#define D_ITEM_WEIGHT "Item weight"
#define D_REFERENCE_WEIGHT "Reference weigth"
#define D_CALIBRATE "Calibrate"
#define D_CALIBRATION "Calibration"
//xsns_35_tx20.ino
#define D_TX20_WIND_DIRECTION "Wind Direction"

View File

@ -461,6 +461,13 @@
#define D_HX_CAL_REFERENCE "Load reference weigth"
#define D_HX_CAL_DONE "Calibrated"
#define D_HX_CAL_FAIL "Calibration failed"
#define D_RESET_HX711 "Reset Scale"
#define D_CONFIGURE_HX711 "Configure Scale"
#define D_HX711_PARAMETERS "Scale parameters"
#define D_ITEM_WEIGHT "Item weight"
#define D_REFERENCE_WEIGHT "Reference weigth"
#define D_CALIBRATE "Calibrate"
#define D_CALIBRATION "Calibration"
//xsns_35_tx20.ino
#define D_TX20_WIND_DIRECTION "Wind Direction"

View File

@ -461,6 +461,13 @@
#define D_HX_CAL_REFERENCE "Load reference weigth"
#define D_HX_CAL_DONE "Calibrated"
#define D_HX_CAL_FAIL "Calibration failed"
#define D_RESET_HX711 "Reset Scale"
#define D_CONFIGURE_HX711 "Configure Scale"
#define D_HX711_PARAMETERS "Scale parameters"
#define D_ITEM_WEIGHT "Item weight"
#define D_REFERENCE_WEIGHT "Reference weigth"
#define D_CALIBRATE "Calibrate"
#define D_CALIBRATION "Calibration"
//xsns_35_tx20.ino
#define D_TX20_WIND_DIRECTION "Wind Direction"

View File

@ -461,6 +461,13 @@
#define D_HX_CAL_REFERENCE "Load reference weigth"
#define D_HX_CAL_DONE "Calibrated"
#define D_HX_CAL_FAIL "Calibration failed"
#define D_RESET_HX711 "Reset Scale"
#define D_CONFIGURE_HX711 "Configure Scale"
#define D_HX711_PARAMETERS "Scale parameters"
#define D_ITEM_WEIGHT "Item weight"
#define D_REFERENCE_WEIGHT "Reference weigth"
#define D_CALIBRATE "Calibrate"
#define D_CALIBRATION "Calibration"
//xsns_35_tx20.ino
#define D_TX20_WIND_DIRECTION "Wind Direction"

View File

@ -461,6 +461,13 @@
#define D_HX_CAL_REFERENCE "Load reference weigth"
#define D_HX_CAL_DONE "Calibrated"
#define D_HX_CAL_FAIL "Calibration failed"
#define D_RESET_HX711 "Reset Scale"
#define D_CONFIGURE_HX711 "Configure Scale"
#define D_HX711_PARAMETERS "Scale parameters"
#define D_ITEM_WEIGHT "Item weight"
#define D_REFERENCE_WEIGHT "Reference weigth"
#define D_CALIBRATE "Calibrate"
#define D_CALIBRATION "Calibration"
//xsns_35_tx20.ino
#define D_TX20_WIND_DIRECTION "Wind Direction"

View File

@ -461,6 +461,13 @@
#define D_HX_CAL_REFERENCE "Load reference weigth"
#define D_HX_CAL_DONE "Calibrated"
#define D_HX_CAL_FAIL "Calibration failed"
#define D_RESET_HX711 "Reset Scale"
#define D_CONFIGURE_HX711 "Configure Scale"
#define D_HX711_PARAMETERS "Scale parameters"
#define D_ITEM_WEIGHT "Item weight"
#define D_REFERENCE_WEIGHT "Reference weigth"
#define D_CALIBRATE "Calibrate"
#define D_CALIBRATION "Calibration"
//xsns_35_tx20.ino
#define D_TX20_WIND_DIRECTION "Wind Direction"

View File

@ -461,6 +461,13 @@
#define D_HX_CAL_REFERENCE "Load reference weigth"
#define D_HX_CAL_DONE "Calibrated"
#define D_HX_CAL_FAIL "Calibration failed"
#define D_RESET_HX711 "Reset Scale"
#define D_CONFIGURE_HX711 "Configure Scale"
#define D_HX711_PARAMETERS "Scale parameters"
#define D_ITEM_WEIGHT "Item weight"
#define D_REFERENCE_WEIGHT "Reference weigth"
#define D_CALIBRATE "Calibrate"
#define D_CALIBRATION "Calibration"
//xsns_35_tx20.ino
#define D_TX20_WIND_DIRECTION "Wind Direction"

View File

@ -375,6 +375,7 @@
//#define USE_TM1638 // Add support for TM1638 switches copying Switch1 .. Switch8 (+1k code)
#define USE_HX711 // Add support for HX711 load cell (+1k5 code)
// #define USE_HX711_GUI // Add optional web GUI to HX711 as scale (+1k8 code)
#define USE_RF_FLASH // Add support for flashing the EFM8BB1 chip on the Sonoff RF Bridge. C2CK must be connected to GPIO4, C2D to GPIO5 on the PCB (+3k code)

View File

@ -77,7 +77,7 @@ const char HTTP_HEAD[] PROGMEM =
"lt=setTimeout(la,{a});" // Settings.web_refresh
"}"
"function lb(p){"
"la('?d='+p);"
"la('?d='+p);" // ?d related to WebGetArg("d", tmp, sizeof(tmp));
"}"
"function lc(p){"
"la('?t='+p);" // ?t related to WebGetArg("t", tmp, sizeof(tmp));
@ -293,7 +293,7 @@ const char HTTP_END[] PROGMEM =
"</body>"
"</html>";
const char HTTP_DEVICE_CONTROL[] PROGMEM = "<td style='width:%d%%'><button onclick='la(\"?o=%d\");'>%s%s</button></td>";
const char HTTP_DEVICE_CONTROL[] PROGMEM = "<td style='width:%d%%'><button onclick='la(\"?o=%d\");'>%s%s</button></td>"; // ?o is related to WebGetArg("o", tmp, sizeof(tmp));
const char HTTP_DEVICE_STATE[] PROGMEM = "%s<td style='width:%d{c}%s;font-size:%dpx'>%s</div></td>"; // {c} = %'><div style='text-align:center;font-weight:
const char HDR_CTYPE_PLAIN[] PROGMEM = "text/plain";
@ -371,6 +371,7 @@ void StartWebserver(int type, IPAddress ipweb)
HueWemoAddHandlers();
#endif // USE_EMULATION
XdrvCall(FUNC_WEB_ADD_HANDLER);
XsnsCall(FUNC_WEB_ADD_HANDLER);
#endif // Not BE_MINIMAL
}
reset_web_log_flag = 0;
@ -596,7 +597,7 @@ void HandleRoot()
if (idx > 0) { page += F("</tr><tr>"); }
for (byte j = 0; j < 4; j++) {
idx++;
snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("<td style='width:25%'><button onclick='la(\"?k=%d\");'>%d</button></td>"), idx, idx);
snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("<td style='width:25%'><button onclick='la(\"?k=%d\");'>%d</button></td>"), idx, idx); // ?k is related to WebGetArg("k", tmp, sizeof(tmp));
page += mqtt_data;
}
}
@ -606,6 +607,7 @@ void HandleRoot()
#ifndef BE_MINIMAL
mqtt_data[0] = '\0';
XdrvCall(FUNC_WEB_ADD_MAIN_BUTTON);
XsnsCall(FUNC_WEB_ADD_MAIN_BUTTON);
page += String(mqtt_data);
#endif // Not BE_MINIMAL
@ -711,6 +713,7 @@ void HandleConfiguration()
mqtt_data[0] = '\0';
XdrvCall(FUNC_WEB_ADD_BUTTON);
XsnsCall(FUNC_WEB_ADD_BUTTON);
page += String(mqtt_data);
page += FPSTR(HTTP_BTN_MENU4);

View File

@ -52,6 +52,11 @@
#define HX_GAIN_32 2 // Channel B, gain factor 32
#define HX_GAIN_64 3 // Channel A, gain factor 64
#define D_JSON_WEIGHT_REF "WeightRef"
#define D_JSON_WEIGHT_CAL "WeightCal"
#define D_JSON_WEIGHT_MAX "WeightMax"
#define D_JSON_WEIGHT_ITEM "WeightItem"
enum HxCalibrationSteps { HX_CAL_END, HX_CAL_LIMBO, HX_CAL_FINISH, HX_CAL_FAIL, HX_CAL_DONE, HX_CAL_FIRST, HX_CAL_RESET, HX_CAL_START };
const char kHxCalibrationStates[] PROGMEM = D_HX_CAL_FAIL "|" D_HX_CAL_DONE "|" D_HX_CAL_REFERENCE "|" D_HX_CAL_REMOVE;
@ -169,7 +174,7 @@ bool HxCommand()
hx_calibrate_timer = 1;
HxCalibrationStateTextJson(3);
break;
case 3: // WeightSet to user reference
case 3: // WeightRef to user reference
if (strstr(XdrvMailbox.data, ",")) {
Settings.weight_reference = strtol(subStr(sub_string, XdrvMailbox.data, ",", 2), NULL, 10);
}
@ -201,7 +206,7 @@ bool HxCommand()
if (show_parms) {
char item[10];
dtostrfd((float)Settings.weight_item / 10, 1, item);
snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"Sensor34\":{\"WeightSet\":%d,\"WeightCal\":%d,\"WeightMax\":%d,\"WeightItem\":%s}}"),
snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"Sensor34\":{\"" D_JSON_WEIGHT_REF "\":%d,\"" D_JSON_WEIGHT_CAL "\":%d,\"" D_JSON_WEIGHT_MAX "\":%d,\"" D_JSON_WEIGHT_ITEM "\":%s}}"),
Settings.weight_reference, Settings.weight_calibration, Settings.weight_max * 1000, item);
}
@ -353,6 +358,109 @@ void HxShow(boolean json)
}
}
#ifdef USE_WEBSERVER
#ifdef USE_HX711_GUI
/*********************************************************************************************\
* Optional GUI
\*********************************************************************************************/
#define WEB_HANDLE_HX711 "s34"
const char S_CONFIGURE_HX711[] PROGMEM = D_CONFIGURE_HX711;
const char HTTP_BTN_MENU_MAIN_HX711[] PROGMEM =
"<br/><form action='" WEB_HANDLE_HX711 "' method='get'><button name='reset'>" D_RESET_HX711 "</button></form>";
const char HTTP_BTN_MENU_HX711[] PROGMEM =
"<br/><form action='" WEB_HANDLE_HX711 "' method='get'><button>" D_CONFIGURE_HX711 "</button></form>";
const char HTTP_FORM_HX711[] PROGMEM =
"<fieldset><legend><b>&nbsp;" D_CALIBRATION "&nbsp;</b></legend>"
"<form method='post' action='" WEB_HANDLE_HX711 "'>"
"<br/><b>" D_REFERENCE_WEIGHT "</b> (" D_UNIT_KILOGRAM ")<br/><input type='number' step='0.001' id='p1' name='p1' placeholder='0' value='{1'><br/>"
"<br/><button name='calibrate' type='submit'>" D_CALIBRATE "</button><br/>"
"</form>"
"</fieldset><br/><br/>"
"<fieldset><legend><b>&nbsp;" D_HX711_PARAMETERS "&nbsp;</b></legend>"
"<form method='post' action='" WEB_HANDLE_HX711 "'>"
"<br/><b>" D_ITEM_WEIGHT "</b> (" D_UNIT_KILOGRAM ")<br/><input type='number' max='6.5535' step='0.0001' id='p2' name='p2' placeholder='0.0' value='{2'><br/>";
void HandleHxAction()
{
if (HttpUser()) { return; }
if (!WebAuthenticate()) { return WebServer->requestAuthentication(); }
AddLog_P(LOG_LEVEL_DEBUG, S_LOG_HTTP, S_CONFIGURE_HX711);
if (WebServer->hasArg("save")) {
HxSaveSettings();
HandleConfiguration();
return;
}
char tmp[100];
if (WebServer->hasArg("reset")) {
snprintf_P(tmp, sizeof(tmp), PSTR("Sensor34 1")); // Reset
ExecuteWebCommand(tmp, SRC_WEBGUI);
HandleRoot(); // Return to main screen
return;
}
if (WebServer->hasArg("calibrate")) {
WebGetArg("p1", tmp, sizeof(tmp));
Settings.weight_reference = (!strlen(tmp)) ? 0 : (unsigned long)(CharToDouble(tmp) * 1000);
HxLogUpdates();
snprintf_P(tmp, sizeof(tmp), PSTR("Sensor34 2")); // Start calibration
ExecuteWebCommand(tmp, SRC_WEBGUI);
HandleRoot(); // Return to main screen
return;
}
String page = FPSTR(HTTP_HEAD);
page.replace(F("{v}"), FPSTR(D_CONFIGURE_HX711));
page += FPSTR(HTTP_HEAD_STYLE);
page += FPSTR(HTTP_FORM_HX711);
dtostrfd((float)Settings.weight_reference / 1000, 3, tmp);
page.replace("{1", String(tmp));
dtostrfd((float)Settings.weight_item / 10000, 4, tmp);
page.replace("{2", String(tmp));
page += FPSTR(HTTP_FORM_END);
page += FPSTR(HTTP_BTN_CONF);
ShowPage(page);
}
void HxSaveSettings()
{
char tmp[100];
WebGetArg("p2", tmp, sizeof(tmp));
Settings.weight_item = (!strlen(tmp)) ? 0 : (uint16_t)(CharToDouble(tmp) * 10000);
HxLogUpdates();
}
void HxLogUpdates()
{
char weigth_ref_chr[10];
char weigth_item_chr[10];
dtostrfd((float)Settings.weight_reference / 1000, Settings.flag2.weight_resolution, weigth_ref_chr);
dtostrfd((float)Settings.weight_item / 10000, 4, weigth_item_chr);
snprintf_P(log_data, sizeof(log_data), PSTR(D_LOG_WIFI D_JSON_WEIGHT_REF " %s, " D_JSON_WEIGHT_ITEM " %s"),
weigth_ref_chr, weigth_item_chr);
AddLog(LOG_LEVEL_INFO);
}
#endif // USE_HX711_GUI
#endif // USE_WEBSERVER
/*********************************************************************************************\
* Interface
\*********************************************************************************************/
@ -381,6 +489,17 @@ boolean Xsns34(byte function)
case FUNC_WEB_APPEND:
HxShow(0);
break;
#ifdef USE_HX711_GUI
case FUNC_WEB_ADD_MAIN_BUTTON:
strncat_P(mqtt_data, HTTP_BTN_MENU_MAIN_HX711, sizeof(mqtt_data));
break;
case FUNC_WEB_ADD_BUTTON:
strncat_P(mqtt_data, HTTP_BTN_MENU_HX711, sizeof(mqtt_data));
break;
case FUNC_WEB_ADD_HANDLER:
WebServer->on("/" WEB_HANDLE_HX711, HandleHxAction);
break;
#endif // USE_HX711_GUI
#endif // USE_WEBSERVER
}
}

View File

@ -38,10 +38,10 @@ extern "C" {
#ifdef USE_WEBSERVER
const char HTTP_SNS_TX20[] PROGMEM = "%s"
"{s} " D_TX20_WIND_SPEED "{m}%s " D_UNIT_KILOMETER_PER_HOUR "{e}"
"{s} " D_TX20_WIND_SPEED_AVG "{m}%s " D_UNIT_KILOMETER_PER_HOUR "{e}"
"{s} " D_TX20_WIND_SPEED_MAX "{m}%s " D_UNIT_KILOMETER_PER_HOUR "{e}"
"{s} " D_TX20_WIND_DIRECTION "{m}%s {e}";
"{s}TX20 " D_TX20_WIND_SPEED "{m}%s " D_UNIT_KILOMETER_PER_HOUR "{e}"
"{s}TX20 " D_TX20_WIND_SPEED_AVG "{m}%s " D_UNIT_KILOMETER_PER_HOUR "{e}"
"{s}TX20 " D_TX20_WIND_SPEED_MAX "{m}%s " D_UNIT_KILOMETER_PER_HOUR "{e}"
"{s}TX20 " D_TX20_WIND_DIRECTION "{m}%s{e}";
#endif // USE_WEBSERVER