Problem: Bad Defaluts for /uart?/passthrough_mode
Wiki Search Terms
It appears that the output of $CD on my controller initializes /uart1/passthrough_mode to the string "80.0" even though the field is not defined in my config.yaml.
This means that performing a "$CD=config.yaml" ends up persisting a bad value to the config.yaml which then fails validation in Uart.decodeUartMode which then causes the controller to fail to boot.
From what I can tell if "passthrough_baud" is zero (as it is in my case) then it does not make sense to perform validation on "passthrough_mode", or Alternatively passthrough_mode could be set with a default which fits over 50% of use cases)
Controller Board
Jackpot V1, although this issue appears to occur when running a disconnected ESP32.
Machine Description
V1E LR2
Input Circuits
This issue does not relate to input circuits.
Configuration file
board: Jackpot TMC2209
name: LowRider
meta: 10-31-2024 RyanZ [UGS]
stepping:
engine: I2S_STATIC
idle_ms: '255'
pulse_us: '2'
dir_delay_us: '1'
disable_delay_us: '0'
segments: '12'
uart1:
txd_pin: gpio.0
rxd_pin: gpio.4
rts_pin: NO_PIN
cts_pin: NO_PIN
baud: '115200'
mode: 8N1
passthrough_baud: '0'
passthrough_mode: '80.0'
i2so:
bck_pin: gpio.22
data_pin: gpio.21
ws_pin: gpio.17
min_pulse_us: '2'
spi:
miso_pin: gpio.19
mosi_pin: gpio.23
sck_pin: gpio.18
sdcard:
cs_pin: gpio.5
card_detect_pin: NO_PIN
frequency_hz: '20000000'
kinematics:
Cartesian: null
axes:
shared_stepper_disable_pin: NO_PIN
shared_stepper_reset_pin: NO_PIN
homing_runs: '2'
x:
steps_per_mm: '50.0'
max_rate_mm_per_min: '9000.0'
acceleration_mm_per_sec2: '200.0'
max_travel_mm: '1405.0'
soft_limits: 'true'
homing:
cycle: '2'
allow_single_axis: 'true'
positive_direction: 'false'
mpos_mm: '4.001'
feed_mm_per_min: '300.0'
seek_mm_per_min: '1500.0'
settle_ms: '500'
seek_scaler: '1.1'
feed_scaler: '1.1'
motor0:
limit_neg_pin: NO_PIN
limit_pos_pin: NO_PIN
limit_all_pin: gpio.25:low
hard_limits: 'true'
pulloff_mm: '7.0'
tmc_2209:
addr: '0'
cs_pin: NO_PIN
uart_num: '1'
step_pin: I2SO.2
direction_pin: I2SO.1
disable_pin: I2SO.0
r_sense_ohms: '0.11'
run_amps: '0.8'
hold_amps: '0.7'
microsteps: '8'
toff_disable: '0'
toff_stealthchop: '5'
use_enable: 'false'
run_mode: StealthChop
homing_mode: StealthChop
homing_amps: '0.8'
stallguard: '0'
stallguard_debug: 'false'
toff_coolstep: '3'
y:
steps_per_mm: '50.0'
max_rate_mm_per_min: '9000.0'
acceleration_mm_per_sec2: '200.0'
max_travel_mm: '2480.0'
soft_limits: 'true'
homing:
cycle: '2'
allow_single_axis: 'true'
positive_direction: 'false'
mpos_mm: '3.0'
feed_mm_per_min: '300.0'
seek_mm_per_min: '1500.0'
settle_ms: '500'
seek_scaler: '1.1'
feed_scaler: '1.1'
motor0:
limit_neg_pin: NO_PIN
limit_pos_pin: NO_PIN
limit_all_pin: NO_PIN
hard_limits: 'false'
pulloff_mm: '4.0'
tmc_2209:
addr: '1'
cs_pin: NO_PIN
uart_num: '1'
step_pin: I2SO.5
direction_pin: I2SO.4
disable_pin: I2SO.7
r_sense_ohms: '0.11'
run_amps: '0.8'
hold_amps: '0.7'
microsteps: '8'
toff_disable: '0'
toff_stealthchop: '5'
use_enable: 'false'
run_mode: StealthChop
homing_mode: StealthChop
homing_amps: '0.8'
stallguard: '0'
stallguard_debug: 'false'
toff_coolstep: '3'
motor1:
limit_neg_pin: gpio.33:low
limit_pos_pin: NO_PIN
limit_all_pin: NO_PIN
hard_limits: 'true'
pulloff_mm: '4.1'
tmc_2209:
addr: '3'
cs_pin: I2SO.14
uart_num: '1'
step_pin: I2SO.13
direction_pin: I2SO.12
disable_pin: I2SO.15
r_sense_ohms: '0.11'
run_amps: '0.8'
hold_amps: '0.7'
microsteps: '8'
toff_disable: '0'
toff_stealthchop: '5'
use_enable: 'false'
run_mode: StealthChop
homing_mode: StealthChop
homing_amps: '0.8'
stallguard: '0'
stallguard_debug: 'false'
toff_coolstep: '3'
z:
steps_per_mm: '200.0'
max_rate_mm_per_min: '1800.0'
acceleration_mm_per_sec2: '80.0'
max_travel_mm: '300.0'
soft_limits: 'true'
homing:
cycle: '1'
allow_single_axis: 'true'
positive_direction: 'true'
mpos_mm: '3.0'
feed_mm_per_min: '200.0'
seek_mm_per_min: '800.0'
settle_ms: '500'
seek_scaler: '1.1'
feed_scaler: '1.1'
motor0:
limit_neg_pin: NO_PIN
limit_pos_pin: NO_PIN
limit_all_pin: gpio.32:low
hard_limits: 'true'
pulloff_mm: '4.0'
tmc_2209:
addr: '2'
cs_pin: NO_PIN
uart_num: '1'
step_pin: I2SO.10
direction_pin: I2SO.9
disable_pin: I2SO.8
r_sense_ohms: '0.11'
run_amps: '0.8'
hold_amps: '0.7'
microsteps: '8'
toff_disable: '0'
toff_stealthchop: '5'
use_enable: 'false'
run_mode: StealthChop
homing_mode: StealthChop
homing_amps: '0.8'
stallguard: '0'
stallguard_debug: 'false'
toff_coolstep: '3'
motor1:
limit_neg_pin: NO_PIN
limit_pos_pin: NO_PIN
limit_all_pin: gpio.34:low
hard_limits: 'true'
pulloff_mm: '4.0'
tmc_2209:
addr: '3'
cs_pin: I2SO.19
uart_num: '1'
step_pin: I2SO.18
direction_pin: I2SO.17
disable_pin: I2SO.16
r_sense_ohms: '0.11'
run_amps: '0.8'
hold_amps: '0.7'
microsteps: '8'
toff_disable: '0'
toff_stealthchop: '5'
use_enable: 'false'
run_mode: StealthChop
homing_mode: StealthChop
homing_amps: '0.8'
stallguard: '0'
stallguard_debug: 'false'
toff_coolstep: '3'
control:
safety_door_pin: NO_PIN
reset_pin: NO_PIN
feed_hold_pin: NO_PIN
cycle_start_pin: NO_PIN
macro0_pin: NO_PIN
macro1_pin: NO_PIN
macro2_pin: NO_PIN
macro3_pin: NO_PIN
fault_pin: NO_PIN
estop_pin: NO_PIN
homing_button_pin: NO_PIN
coolant:
flood_pin: gpio.2
mist_pin: gpio.16
delay_ms: '0'
probe:
pin: gpio.36:low
toolsetter_pin: gpio.13
check_mode_start: 'false'
hard_stop: 'false'
probe_hard_limit: 'true'
macros:
startup_line0: null
startup_line1: null
Macro0: null
Macro1: null
Macro2: null
Macro3: null
after_homing: null
after_reset: null
after_unlock: null
start:
must_home: 'false'
deactivate_parking: 'false'
check_limits: 'true'
parking:
enable: 'false'
axis: Z
target_mpos_mm: '-5.0'
rate_mm_per_min: '800.0'
pullout_distance_mm: '5.0'
pullout_rate_mm_per_min: '250.0'
user_outputs:
analog0_pin: NO_PIN
analog1_pin: NO_PIN
analog2_pin: NO_PIN
analog3_pin: NO_PIN
analog0_hz: '5000'
analog1_hz: '5000'
analog2_hz: '5000'
analog3_hz: '5000'
digital0_pin: gpio.26
digital1_pin: gpio.27
digital2_pin: NO_PIN
digital3_pin: NO_PIN
digital4_pin: NO_PIN
digital5_pin: NO_PIN
digital6_pin: NO_PIN
digital7_pin: NO_PIN
user_inputs:
analog0_pin: NO_PIN
analog1_pin: NO_PIN
analog2_pin: NO_PIN
analog3_pin: NO_PIN
digital0_pin: NO_PIN
digital1_pin: NO_PIN
digital2_pin: NO_PIN
digital3_pin: NO_PIN
digital4_pin: NO_PIN
digital5_pin: NO_PIN
digital6_pin: NO_PIN
digital7_pin: NO_PIN
arc_tolerance_mm: '0.002'
junction_deviation_mm: '0.01'
verbose_errors: 'true'
report_inches: 'false'
enable_parking_override_control: 'false'
use_line_numbers: 'false'
planner_blocks: '32'
Startup Messages
Number of data bits for uart is out of range. Expected format like [8N1].
User Interface Software
https://github.com/dnikodem84/Universal-G-Code-Sender/tree/ProbePanelSetup
What happened?
I am currently working on giving the UGS Setup Wizard the ability to update the config.yaml, My Initial approach was to send $CD=config.yaml; $config/Filename=config.yaml;$System/Control=RESTART,
This caused the controller to fail to boot and started to complain about an error on line 19 of the config (/uart1/passthrough_mode=80.0)
GCode File
No response
Other Information
No response
Which version of FluidNC do you have installed?
Is the config file you posted the actual file or a $CD response?
passthrough_mode should look more like this.
passthrough_mode: 8e1
I can not reproduce this. From what I can tell the passthrough_mode was introduced in v3.9.5 so I started from the version prior to that.
- Installed v3.9.4 using this config
uart1:
txd_pin: gpio.0
rxd_pin: gpio.4
baud: 115200
mode: 8N1
- Installed v3.9.5 and rebooted
- Did a $CD=config.yaml which gave added these default values:
uart1:
txd_pin: gpio.0
rxd_pin: gpio.4
rts_pin: NO_PIN
cts_pin: NO_PIN
baud: 115200
mode: 8N1
passthrough_baud: 0
passthrough_mode: 8E1
I repeated the process for v3.9.9 and got the same result.
Ah wait a minute I think that I found the problem.
When using the config editor in the fluid-installer it will attempt to parse this yaml config value: passthrough_mode: 8E1
The value 8E1 will be treated as a numeric value, and with the math notation it will become 80.
I'll see if I can make a work around for it in the fluid installer config editor.
8E1 == 8*10^1. Oops.
The FluidNC syntax is not pure YAML. One major deviation is that, whereas real YAML has data types that are determined syntactically, FluidNC item values are syntactically just strings, and each individual item is responsible for interpreting the string according to the item's type.
If that problem originated from the fluid-installer config editor it should now be resolved. It will look for values with \d+E\d+ and wrap them with " as a string.
I encountered the issue when sending commands via a customized version of UGS ( https://github.com/dnikodem84/Universal-G-Code-Sender/tree/ProbePanelSetup ).
That being said,
I was using the fluidNC Web Installer to:
- re-upload config files.
- Using the terminal to check settings.
I have not dug into the code of this project but from what I can tell, the "DataBits/Parity/StopBits" string is evaluating somewhere to a Floating Point Value due to the fact that 8e1 is perfectly valid scientific notation.
It is likely UGS. We are using a Yaml-library which probably parses this as a numeric value and converts it to an integer:
We will either need the same YAML-hack in UGS or FluidNC needs to start returning strings with string literals.
I just filed a bug report with SpiderYaml (The library which UGS uses for YAML parsing) https://bitbucket.org/snakeyaml/snakeyaml/issues/1109/cannot-use-snakeyaml-to-parse-serial
After Thanksgiving I will give this issue further testing and most likely close it.
Looking at this and remembering that good systems are liberal with what they accept and conservative with what they send I decided that the best thing to do is to patch the issue in both FluidNC and UGS.
UGS SHOULD be creating a custom resolver which intentionally avoids creating floats ( and dates ) for any fields because 8e1,8e2, 7e1 are all valid floats and UGS knows that some of those strings should not be resolved to floats. I already have the changes in my branch.
FluidNC should accept 80.0, 70.0, 800.0, and 700.0 as valid floating point representations of 8e1,7e1, 8e2, etc.
I have put together a PR ( https://github.com/bdring/FluidNC/pull/1616 ) so once that gets accepted following review and review comments I can close this issue.