update division by zero

origin
steffen 5 years ago
parent 5987dde99b
commit dc7bbe8099

@ -1,3 +1,6 @@
2020-12-05:
- locomotive fixed division by zero
2020-11-29: 2020-11-29:
- lococtrl display is now working with reverse and forward. - lococtrl display is now working with reverse and forward.

@ -263,7 +263,7 @@ int Locomotives::SetSpeedFromBus(string ifname, int addr, int speed) {
case LOCO_INT_DCC14: maxstep = 14; break; case LOCO_INT_DCC14: maxstep = 14; break;
case LOCO_INT_DCC28: maxstep = 28; break; case LOCO_INT_DCC28: maxstep = 28; break;
case LOCO_INT_DCC128: maxstep = 126; break; case LOCO_INT_DCC128: maxstep = 126; break;
default: maxstep = 0; break; default: maxstep = -1; break;
} }
if (speed == 0) locomotives[i].speed = 0; if (speed == 0) locomotives[i].speed = 0;

@ -417,8 +417,10 @@ function locolist_show() {
// append all locomotives // append all locomotives
for (var i = 0; i < locomotives.length; i++) { for (var i = 0; i < locomotives.length; i++) {
let li = document.createElement("li"); let li = document.createElement("li");
li.appendChild(document.createTextNode(locomotives[i].name)); li.appendChild(document.createTextNode(locomotives[i].name));
li.setAttribute("id", "locol_elm_"+locomotives[i].name); li.setAttribute("id", "locol_elm_"+locomotives[i].name);
ul.appendChild(li); ul.appendChild(li);
gAddEventListener("locol_elm_"+locomotives[i].name, 'click', locolist_clicked); gAddEventListener("locol_elm_"+locomotives[i].name, 'click', locolist_clicked);

Loading…
Cancel
Save