Conversation
| // Max offset is half the horizon height to keep horizon visible | ||
| let max_pitch_offset = (horizon_height as f32) / 2.0; | ||
| let pitch_offset = | ||
| (-pitch_deg / osd_config.pitch_scale).clamp(-max_pitch_offset, max_pitch_offset); |
There was a problem hiding this comment.
Bug: Division by zero possible with configurable pitch_scale
The new configurable pitch_scale parameter is used as a divisor in horizon and pitch ladder calculations without validation. If a user sets pitch_scale to 0 in the config (the documentation describing "lower values = more sensitive" might encourage very low values), the divisions at lines 127 and 188 will produce Infinity or NaN, causing garbled OSD rendering. The previous hardcoded values (10.0, 2.5) could never be zero. Consider adding validation to ensure pitch_scale is positive.
Additional Locations (1)
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| # Write to Elodin-DB (handles reconnection if client was unavailable at startup) | ||
| if IMPELLER_AVAILABLE: | ||
| self._write_to_db(component_name, values.astype(np.float64), msg) |
There was a problem hiding this comment.
Keep retrying DB connect after startup failure
The new unconditional call to _write_to_db (now executed whenever impeller_py is importable) means the reconnect branch runs even when no client is initialized, but _write_to_db sets self.client = ImpellerClient(...) before calling connect() and returns on failure without clearing it. If the DB is still down on that first reconnect attempt, self.client remains truthy while _db_available is false, so subsequent packets skip the reconnect block and keep using the dead client; the receiver never starts writing when the DB finally comes up unless the process is restarted.
Useful? React with 👍 / 👎.
* Fix for horizon line, make pitch scaleable * Add msp-osd auto-record feature * Add time configuration to udp-component-receive
Small improvements for the msp-osd artificial horizon with configurable pitch scale and character aspect ratio settings to better match camera FOV and HD OSD character dimensions, and adds an auto-record feature to automatically start VTX DVR recording on service startup. It also fixes serial reconnection handling. For UDP component receive, a new timestamp mode option lets users choose between sender, local, or monotonic clock timestamps when writing to Elodin-DB.
Note
Adds OSD horizon calibration (char aspect ratio, pitch scale), optional VTX auto-record via MSPv2, and a new timestamp mode for UDP receiver, with NixOS options and docs updated.
osd.char_aspect_ratioandosd.pitch_scale;layout.rsuses these for horizon tilt and pitch ladder;main.rspasses fullOsdConfig.serial.auto_record; implement MSPv2MSP2_COMMON_SET_RECORDINGinbackends/displayport.rsand trigger on init when enabled.charAspectRatio,pitchScale, andautoRecord; write them toconfig.toml.README.mdandconfig.tomlwith new options and guidance.--timestamp-mode {sender|local|monotonic}; apply selected timestamp when writing to Elodin-DB.timestampModeand pass viaExecStart.flake.nixcomments to document new OSD calibration and receiver timestamp options.Written by Cursor Bugbot for commit bc2f4cb. This will update automatically on new commits. Configure here.