Add supply current display for Orion MkII (Board 5)

UserADC1 (bytes 55-56) carries current sensor data on the ANAN-8000DLE.
Formula from Thetis: amps = ((adc/4095 * 5000) - 360) / 120 (Voff=360mV,
Sens=120mV/A). Status bar now shows "Supply: 13.8V / 2.3A | PLL OK"
when current is available.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-19 12:29:45 +03:00
co-authored by Claude Sonnet 4.6
parent d823106366
commit d8050576a9
2 changed files with 54 additions and 13 deletions
+17
View File
@@ -392,6 +392,10 @@ function PhaseWordToFreq(PhaseWord: LongWord): Double;
// Returns -1.0 if the board has no supply voltage measurement.
function ADCToSupplyVolts(RawADC: Word; BoardType: Integer): Double;
// Convert raw ADC value to supply current in Amps (Board 5 / Orion MkII only)
// Uses UserADC1 (bytes 55-56). Returns -1 for unsupported boards.
function ADCToSupplyCurrent(RawADC: Word; BoardType: Integer): Double;
// Convert raw ADC value to RF power in Watts (ANAN-100)
function ADCToWatts100(RawADC: Word): Double;
@@ -454,6 +458,19 @@ begin
end;
end;
function ADCToSupplyCurrent(RawADC: Word; BoardType: Integer): Double;
begin
// Board 5 (Orion MkII): UserADC1, Vref=5V → mV = adc/4095*5000.
// Current sensor: Voff=360mV, Sens=120mV/A (Thetis defaults, ACS712-style).
// Formula: amps = (mV - Voff) / Sens.
if BoardType = 5 then
begin
Result := ((RawADC / 4095.0) * 5000.0 - 360.0) / 120.0;
if Result < 0.0 then Result := 0.0;
end else
Result := -1.0;
end;
function ADCToWatts100(RawADC: Word): Double;
var
V: Double;