-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Description
The values for boolean INI variables are not handled consistently in LinuxCNC.
As per documentation
https://linuxcnc.org/docs/devel/html/config/ini-config.html#sub:ini:variables
Boolean values can be on one of TRUE, YES or 1 for true/enabled and one of FALSE, NO or 0 for false/disabled. The case is ignored.
There are some references in the docs indicating that the above does not apply to all boolean variables.
Examples:
LATHE = 1 - Any non-empty value (including "0") causes axis to use "lathe mode" with a top view and with Radius and Diameter on the DRO.
BACK_TOOL_LATHE = 1 - Any non-empty value (including "0") causes axis to use "back tool lathe mode" with inverted X axis.
FOAM = 1 - Any non-empty value (including "0") causes axis to change the display for foam-cutter mode.
Note though that some parts of the code follow none of the above:
linuxcnc/src/emc/usr_intf/gremlin/gremlin.py
Lines 197 to 199 in 878f171
| temp = inifile.find("DISPLAY", "LATHE") | |
| self.lathe_option = bool(temp == "1" or temp == "True" or temp == "true" ) | |
| self.foam_option = bool(inifile.find("DISPLAY", "FOAM")) |
Using ''WRAPPED_ROTARY' with AxisGUI serves as an example of what kind of issues this can lead to:
-
'#'WRAPPED_ROTARY = 1' (or simply no entry)
-> Interpreter: not wrapped_rotary
-> AxisGUI : not wrapped_rotary
MDI: 'G0 A400' -> A-axis moves to '400' -
'WRAPPED_ROTARY = 1'
-> Interpreter: wrapped_rotary
-> AxisGUI : wrapped_rotary
MDI: 'G0 A400' -> We get the expected interpreter error and no movement -
'WRAPPED_ROTARY = 0' (actually anything other than '1')
-> Interpreter: not wrapped_rotary
-> AxisGUI : wrapped_rotary
MDI command : 'G0 A400' -> We get no error and movement to A: 40
Testing done using 'configs/sim/axis/axis_9axis.ini' in current 2.9 and master