mirror of
https://github.com/jkingsman/Remote-Terminal-for-MeshCore.git
synced 2026-08-10 10:43:01 +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: '%',
|
humidity: '%',
|
||||||
barometer: 'hPa',
|
barometer: 'hPa',
|
||||||
voltage: 'V',
|
voltage: 'V',
|
||||||
current: 'mA',
|
current: 'A',
|
||||||
luminosity: 'lux',
|
luminosity: 'lux',
|
||||||
altitude: 'm',
|
altitude: 'm',
|
||||||
power: 'W',
|
power: 'W',
|
||||||
@@ -235,6 +235,10 @@ export function lppDisplayUnit(
|
|||||||
if (typeName === 'temperature' && unitPref === 'imperial') {
|
if (typeName === 'temperature' && unitPref === 'imperial') {
|
||||||
return { unit: '°F', value: (value * 9) / 5 + 32 };
|
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 };
|
return { unit: LPP_UNIT_MAP[typeName] ?? '', value };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user