mirror of
https://github.com/jkingsman/Remote-Terminal-for-MeshCore.git
synced 2026-05-14 21:36:03 +02:00
current sensor unit
fix wrong unit in lpp sensors, add convertion between A and mA
This commit is contained in:
@@ -212,7 +212,7 @@ export const LPP_UNIT_MAP: Record<string, string> = {
|
||||
humidity: '%',
|
||||
barometer: 'hPa',
|
||||
voltage: 'V',
|
||||
current: 'mA',
|
||||
current: 'A',
|
||||
luminosity: 'lux',
|
||||
altitude: 'm',
|
||||
power: 'W',
|
||||
@@ -235,6 +235,10 @@ export function lppDisplayUnit(
|
||||
if (typeName === 'temperature' && unitPref === 'imperial') {
|
||||
return { unit: '°F', value: (value * 9) / 5 + 32 };
|
||||
}
|
||||
if (typeName === 'current') {
|
||||
if (value <= 1)
|
||||
return { unit: 'mA', value: value * 1000 };
|
||||
}
|
||||
return { unit: LPP_UNIT_MAP[typeName] ?? '', value };
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user