Skip to content

WHB04 display refresh raises on missing or malformed spindle values #672

Description

@righteousgambit

Controller version

develop at 2ea66c10e96d88013a04441134d3d4f8e8c88510. This is controller-side display-state handling; firmware is not changed.

Reproduction

Run one WHB04 display callback while CNC.vars has no curspindle entry:

pendant._cnc.vars = {
    "wx": 0.0,
    "wy": 0.0,
    "wz": 0.0,
    "wa": 0.0,
    "curfeed": 0.0,
}
pendant._handle_display_update(daemon)

Malformed (None, "invalid"), non-finite (nan, +inf, -inf), negative, over-range, and finite integers too large for float conversion also reproduce an exception or setter rejection. For example, float(10**10000) raises OverflowError in the sanitizing path.

Expected

The scheduled display refresh should remain live. Missing, malformed, or non-finite spindle values should display as zero; finite values should be clamped to the WHB04's supported 0..65535 range.

Actual

The callback indexes curspindle directly and passes it unsanitized to a strict setter: display callback, setter. The daemon schedules that handler onto the GUI clock from its device loop (scheduling call, clock executor).

Impact

The GUI-clock callback raises and the pendant can retain a stale spindle value (and skip the remainder of that display update). Because the callback is scheduled asynchronously, this is not evidence that the HID read loop reconnects, nor does the callback itself command or alter spindle motion.

Regression proof

An eleven-case test starts the daemon display at a nonzero value and covers missing, None, malformed text, negative, over-range, numeric text, nan, +inf, -inf, and huge positive/negative integers. Against the pinned base all eleven cases raise or retain invalid behavior. The previous patch revision passed the first nine but failed both huge-integer cases with OverflowError.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions