fix battery encoding

This commit is contained in:
Peli de Halleux 2018-01-11 08:47:09 -08:00
parent 893dd0f9c4
commit 9d5ca35e83
2 changed files with 3 additions and 3 deletions

View File

@ -93,7 +93,7 @@ namespace sensors.internal {
init(); init();
return { return {
temp: analogMM.getNumber(NumberFormat.Int16LE, AnalogOff.BatteryTemp), temp: analogMM.getNumber(NumberFormat.Int16LE, AnalogOff.BatteryTemp),
current: analogMM.getNumber(NumberFormat.Int16LE, AnalogOff.BatteryCurrent) current: Math.round(analogMM.getNumber(NumberFormat.Int16LE, AnalogOff.BatteryCurrent) / 10);
} }
} }

View File

@ -30,8 +30,8 @@ namespace pxsim {
data, data,
beforeMemRead: () => { beforeMemRead: () => {
//console.log("analog before read"); //console.log("analog before read");
data[AnalogOff.BatteryTemp] = 21; // TODO simulate this util.map16Bit(data, AnalogOff.BatteryTemp, 21);
data[AnalogOff.BatteryCurrent] = 100; // TODO simulate this util.map16Bit(data, AnalogOff.BatteryCurrent, 900);
const inputNodes = ev3board().getInputNodes(); const inputNodes = ev3board().getInputNodes();
for (let port = 0; port < DAL.NUM_INPUTS; port++) { for (let port = 0; port < DAL.NUM_INPUTS; port++) {
const node = inputNodes[port]; const node = inputNodes[port];