motorRecord.cc: Make sure that ACCS/ACCU are initialized

When the record is initialized, it could happen that the ACCS field
was not initalized at all.
Fix this:
- Introduce a new value for motorACCSused, motorACCSused_Undef.
  This is == 0, and temporally used until the record is initilized.
  Using 0 as Undef will allow a (mis-) use in e.g. CSS to make the ACCS
  field invisable, whe ACCU is 0
  (or not present at all in an older version of the motorRecord)
- At the end of check_speed_and_resolution() set ACCS and ACCU, if needed.
This commit is contained in:
Torsten Bögershausen
2019-01-08 10:40:30 +01:00
parent 7b87f3b9b6
commit 8d1891c5a7
2 changed files with 6 additions and 0 deletions
+5
View File
@@ -4032,6 +4032,11 @@ static void check_speed_and_resolution(motorRecord * pmr)
pmr->hvel = pmr->vbas;
else
range_check(pmr, &pmr->hvel, pmr->vbas, pmr->vmax);
/* Make sure that ACCS/ACCU are initialized */
if (pmr->accu == motorACCSused_Undef)
{
updateACCSfromACCL(pmr);
}
}
/*
+1
View File
@@ -70,6 +70,7 @@ menu(motorRMOD) {
}
menu(motorACCSused) {
choice(motorACCSused_Undef,"Undef")
choice(motorACCSused_Accl, "Accl")
choice(motorACCSused_Accs, "Accs")
}