diff --git a/libs/core/input.ts b/libs/core/input.ts index eb9f03be..9b407a66 100644 --- a/libs/core/input.ts +++ b/libs/core/input.ts @@ -93,7 +93,7 @@ namespace sensors.internal { init(); return { temp: analogMM.getNumber(NumberFormat.Int16LE, AnalogOff.BatteryTemp), - current: analogMM.getNumber(NumberFormat.Int16LE, AnalogOff.BatteryCurrent) + current: Math.round(analogMM.getNumber(NumberFormat.Int16LE, AnalogOff.BatteryCurrent) / 10); } } diff --git a/sim/state/analog.ts b/sim/state/analog.ts index 9f9ea664..195c04cd 100644 --- a/sim/state/analog.ts +++ b/sim/state/analog.ts @@ -30,8 +30,8 @@ namespace pxsim { data, beforeMemRead: () => { //console.log("analog before read"); - data[AnalogOff.BatteryTemp] = 21; // TODO simulate this - data[AnalogOff.BatteryCurrent] = 100; // TODO simulate this + util.map16Bit(data, AnalogOff.BatteryTemp, 21); + util.map16Bit(data, AnalogOff.BatteryCurrent, 900); const inputNodes = ev3board().getInputNodes(); for (let port = 0; port < DAL.NUM_INPUTS; port++) { const node = inputNodes[port];