Skip to content

Commit 5b4cf47

Browse files
committed
Refactor calibration to use per-tank .cfg files
Calibration points are now stored in each tank's .cfg file using CAL_POINT entries, replacing the previous calibration.txt approach. The client code was refactored for per-tank calibration data, config loading, and logging, and the documentation was updated to reflect the new workflow. Legacy files calibration.txt and tank_config.txt were removed, and a config.template.cfg was added as a reference.
1 parent aa9aa32 commit 5b4cf47

File tree

6 files changed

+611
-901
lines changed

6 files changed

+611
-901
lines changed

TankAlarm-092025-Client-Hologram/CALIBRATION_GUIDE.md

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -54,24 +54,26 @@ Access the calibration page at `http://[server-ip]/calibration` to:
5454

5555
## File Structure
5656

57-
### calibration.txt
58-
Stored on tank SD card, contains calibration points in CSV format:
57+
### Per-Tank `.cfg` File
58+
Stored on the tank's SD card, the same file used for all other tank settings. Calibration points are added using the `CAL_POINT` key.
5959
```
60-
# Tank Height Calibration Data
61-
# Format: sensor_value,actual_height_inches,timestamp
62-
0.5000,0.00,2025-01-01T10:00:00
63-
2.2500,24.50,2025-01-01T10:05:00
64-
4.0000,48.00,2025-01-01T10:10:00
60+
# In a file like NorthFarm_101.cfg
61+
SITE_NAME=North Farm
62+
TANK_NUMBER=101
63+
# ... other settings ...
64+
CAL_POINT=0.50,0.0
65+
CAL_POINT=2.25,24.5
66+
CAL_POINT=4.00,48.0
6567
```
6668

6769
## Implementation Details
6870

6971
### Client (Tank) Side
70-
- **Calibration data loading**: Automatic on startup from `calibration.txt`
71-
- **SMS processing**: `processIncomingSMS()` function handles incoming commands
72-
- **Data storage**: `saveCalibrationData()` writes to SD card
73-
- **Height calculation**: `interpolateHeight()` performs linear interpolation
74-
- **Sensor reading**: `getCurrentSensorReading()` gets raw sensor values
72+
- **Calibration data loading**: Automatic on startup from `CAL_POINT` entries in the tank's `.cfg` file.
73+
- **SMS processing**: `processIncomingSMS()` function handles incoming commands. When a `CAL` command is received, a new `CAL_POINT` line is appended to the active `.cfg` file.
74+
- **Data storage**: Calibration points are stored directly in the `.cfg` file on the SD card.
75+
- **Height calculation**: `interpolateHeight()` performs linear interpolation.
76+
- **Sensor reading**: `getCurrentSensorReading()` gets raw sensor values.
7577

7678
### Server Side
7779
- **Web interface**: `/calibration` route displays calibration page

0 commit comments

Comments
 (0)