mirror of
https://github.com/maziggy/bambuddy.git
synced 2026-10-17 19:36:28 +02:00
Fix SpoolBuddy scale tare & calibration not being applied
The tare and calibrate buttons on the Settings page queued commands
but never executed them due to five broken links:
1. Daemon received tare command but never called scale.tare()
2. No endpoint to persist tare offset back to backend DB
3. Heartbeat never called scale.update_calibration()
4. Heartbeat response with stale values overwrote new tare to zero
5. set-factor used DB tare_offset (stale/zero), producing wrong
calibration factor — empty scale showed ~5000g
Fixed daemon to execute tare, persist result, and propagate
calibration. Calibration step now captures raw ADC at tare time
and sends it with step 2, making factor computation self-contained.
Replaced calibration weight input with compact touch numpad for
the RPi kiosk's 1024x600 touchscreen (no physical keyboard).
This commit is contained in:
@@ -4849,10 +4849,10 @@ export const spoolbuddyApi = {
|
||||
getCalibration: (deviceId: string) =>
|
||||
request<{ tare_offset: number; calibration_factor: number }>(`/spoolbuddy/devices/${deviceId}/calibration`),
|
||||
|
||||
setCalibrationFactor: (deviceId: string, knownWeightGrams: number, rawAdc: number) =>
|
||||
setCalibrationFactor: (deviceId: string, knownWeightGrams: number, rawAdc: number, tareRawAdc?: number) =>
|
||||
request<{ tare_offset: number; calibration_factor: number }>(`/spoolbuddy/devices/${deviceId}/calibration/set-factor`, {
|
||||
method: 'POST',
|
||||
body: JSON.stringify({ known_weight_grams: knownWeightGrams, raw_adc: rawAdc }),
|
||||
body: JSON.stringify({ known_weight_grams: knownWeightGrams, raw_adc: rawAdc, tare_raw_adc: tareRawAdc }),
|
||||
}),
|
||||
|
||||
updateSpoolWeight: (spoolId: number, weightGrams: number) =>
|
||||
|
||||
Reference in New Issue
Block a user