firmware: expose temp lookup outside disabled UART block
This commit is contained in:
@@ -946,6 +946,16 @@ setInterval(load,3000);
|
|||||||
WebServer server(80);
|
WebServer server(80);
|
||||||
|
|
||||||
#define API_V1(path) "/api/v1" path
|
#define API_V1(path) "/api/v1" path
|
||||||
|
|
||||||
|
int findTempConfigIndexById(const String& id) {
|
||||||
|
for (int i = 0; i < MAX_TEMP_SENSORS; i++) {
|
||||||
|
if (appConfig.tempSensors[i].id == id) {
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
#if DASHBOARD_UART_ENABLED
|
#if DASHBOARD_UART_ENABLED
|
||||||
HardwareSerial DashboardSerial(2);
|
HardwareSerial DashboardSerial(2);
|
||||||
String uartLineBuffer;
|
String uartLineBuffer;
|
||||||
@@ -2025,16 +2035,6 @@ int findRelayConfigIndexForUart(const String& id) {
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int findTempConfigIndexById(const String& id) {
|
|
||||||
for (int i = 0; i < MAX_TEMP_SENSORS; i++) {
|
|
||||||
if (appConfig.tempSensors[i].id == id) {
|
|
||||||
return i;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
void handleUartMessage(const String& line) {
|
void handleUartMessage(const String& line) {
|
||||||
DynamicJsonDocument doc(1024);
|
DynamicJsonDocument doc(1024);
|
||||||
DeserializationError error = deserializeJson(doc, line);
|
DeserializationError error = deserializeJson(doc, line);
|
||||||
|
|||||||
@@ -458,5 +458,5 @@ def test_temp_config_lookup_is_available_to_http_handlers():
|
|||||||
assert "findTempConfigIndexForUart" not in source
|
assert "findTempConfigIndexForUart" not in source
|
||||||
|
|
||||||
helper_pos = source.index("int findTempConfigIndexById(")
|
helper_pos = source.index("int findTempConfigIndexById(")
|
||||||
uart_guard_pos = source.index("#if DASHBOARD_UART_ENABLED")
|
first_uart_guard_pos = source.index("#if DASHBOARD_UART_ENABLED")
|
||||||
assert helper_pos < uart_guard_pos
|
assert helper_pos < first_uart_guard_pos
|
||||||
|
|||||||
Reference in New Issue
Block a user