Skip to content

Commit a7968f0

Browse files
Copilotdorkmo
andcommitted
Fix all four compilation errors in Arduino sketches
Co-authored-by: dorkmo <[email protected]>
1 parent 9790e7a commit a7968f0

File tree

3 files changed

+25
-24
lines changed

3 files changed

+25
-24
lines changed

TankAlarm-112025-Client-BluesOpta/TankAlarm-112025-Client-BluesOpta.ino

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -276,28 +276,6 @@ static float getDistanceConversionFactor(const char* unit) {
276276
return 1.0f; // Default: assume inches
277277
}
278278

279-
// Helper function: Get tank height/capacity based on sensor configuration
280-
static float getMonitorHeight(const MonitorConfig &cfg) {
281-
if (cfg.sensorInterface == SENSOR_CURRENT_LOOP) {
282-
if (cfg.currentLoopType == CURRENT_LOOP_ULTRASONIC) {
283-
// For ultrasonic sensors, mount height IS the tank height (distance to bottom)
284-
return cfg.sensorMountHeight;
285-
} else {
286-
// For pressure sensors, max range + mount height approximates full tank height
287-
float rangeInches = cfg.sensorRangeMax * getPressureConversionFactor(cfg.sensorRangeUnit);
288-
return rangeInches + cfg.sensorMountHeight;
289-
}
290-
} else if (cfg.sensorInterface == SENSOR_ANALOG) {
291-
// For analog sensors, max range + mount height approximates full tank height
292-
float rangeInches = cfg.sensorRangeMax * getPressureConversionFactor(cfg.sensorRangeUnit);
293-
return rangeInches + cfg.sensorMountHeight;
294-
} else if (cfg.sensorInterface == SENSOR_DIGITAL) {
295-
// Digital sensors are binary, treat 1.0 as full
296-
return 1.0f;
297-
}
298-
return 0.0f;
299-
}
300-
301279
static const uint8_t NOTECARD_I2C_ADDRESS = 0x17;
302280
static const uint32_t NOTECARD_I2C_FREQUENCY = 400000UL;
303281

@@ -450,6 +428,28 @@ struct MonitorRuntime {
450428
unsigned long lastSensorFaultMillis;
451429
};
452430

431+
// Helper function: Get tank height/capacity based on sensor configuration
432+
static float getMonitorHeight(const MonitorConfig &cfg) {
433+
if (cfg.sensorInterface == SENSOR_CURRENT_LOOP) {
434+
if (cfg.currentLoopType == CURRENT_LOOP_ULTRASONIC) {
435+
// For ultrasonic sensors, mount height IS the tank height (distance to bottom)
436+
return cfg.sensorMountHeight;
437+
} else {
438+
// For pressure sensors, max range + mount height approximates full tank height
439+
float rangeInches = cfg.sensorRangeMax * getPressureConversionFactor(cfg.sensorRangeUnit);
440+
return rangeInches + cfg.sensorMountHeight;
441+
}
442+
} else if (cfg.sensorInterface == SENSOR_ANALOG) {
443+
// For analog sensors, max range + mount height approximates full tank height
444+
float rangeInches = cfg.sensorRangeMax * getPressureConversionFactor(cfg.sensorRangeUnit);
445+
return rangeInches + cfg.sensorMountHeight;
446+
} else if (cfg.sensorInterface == SENSOR_DIGITAL) {
447+
// Digital sensors are binary, treat 1.0 as full
448+
return 1.0f;
449+
}
450+
return 0.0f;
451+
}
452+
453453
static ClientConfig gConfig;
454454
static MonitorRuntime gMonitorState[MAX_TANKS];
455455

TankAlarm-112025-Server-BluesOpta/TankAlarm-112025-Server-BluesOpta.ino

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
#else
3030
#include <Ethernet.h>
3131
#endif
32+
#include <SD.h>
3233
#include <math.h>
3334
#include <string.h>
3435
#include <ctype.h>
@@ -3199,7 +3200,7 @@ static void handleFtpRestorePost(EthernetClient &client, const String &body) {
31993200
if (ok) {
32003201
resp["message"] = F("Restore completed from FTP");
32013202
} else {
3202-
resp["error"] = error.length() ? error : F("Restore failed");
3203+
resp["error"] = strlen(error) ? error : F("Restore failed");
32033204
}
32043205
String json;
32053206
serializeJson(resp, json);

TankAlarm-112025-Viewer-BluesOpta/TankAlarm-112025-Viewer-BluesOpta.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -527,7 +527,7 @@ static void sendDashboard(EthernetClient &client) {
527527
static void sendTankJson(EthernetClient &client) {
528528
std::unique_ptr<DynamicJsonDocument> docPtr(new DynamicJsonDocument(TANK_JSON_CAPACITY + 256));
529529
if (!docPtr) {
530-
respondStatus(client, 500, F("Out of Memory"));
530+
respondStatus(client, 500, "Out of Memory");
531531
return;
532532
}
533533
DynamicJsonDocument &doc = *docPtr;

0 commit comments

Comments
 (0)