Conversation
Agent-Logs-Url: https://github.com/electricalhog/FPV-Static-Electronic_Load/sessions/956d0469-6467-4cfd-b908-99615d8116b2 Co-authored-by: electricalhog <15219301+electricalhog@users.noreply.github.com>
…and discharge-curve recording Agent-Logs-Url: https://github.com/electricalhog/FPV-Static-Electronic_Load/sessions/956d0469-6467-4cfd-b908-99615d8116b2 Co-authored-by: electricalhog <15219301+electricalhog@users.noreply.github.com>
Agent-Logs-Url: https://github.com/electricalhog/FPV-Static-Electronic_Load/sessions/956d0469-6467-4cfd-b908-99615d8116b2 Co-authored-by: electricalhog <15219301+electricalhog@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Design fast UI for controlling discharge curves and targets
Add multi-mode control (CC/CP/CR/CV/Discharge), OLED UI, and discharge curve recording to RP2040 electronic load firmware
Mar 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The firmware was a bare prototype: raw PWM duty-cycle via rotary encoder, no measurement feedback, no operating modes, no display. This replaces it with a fully-featured embedded load controller.
New modules
src/control.rsControlModeenum:ConstantCurrent,ConstantPower,ConstantResistance,ConstantVoltage,Dischargecompute_current_ma()— translates each mode's setpoint + ADC measurements into a current demand; CV uses a proportional software loopcurrent_to_dac()— maps milliamp demand to PWM duty-cycle for the external analog current-regulation loopsrc/discharge.rsDischargeCurvestored asstatic mut(≈10.5 KiB in BSS); records up to 1 800 voltage/current/time samples (30 min @ 1 Hz), accumulates capacity in mAh, latches on cutoffMain loop rewrite (
src/main.rs)Loop runs at 1 kHz. ADC sampled every 10 ms, display refreshed every 100 ms, discharge data recorded every 1 s. Under-voltage cutoff in DIS mode stops the load and finalises the curve automatically.
Display layout (FONT_6X10, 128×64):
Dependencies added (
Cargo.toml)ssd1306 = "0.8.4"+embedded-graphics = "0.8.1"— display driver and graphics primitivesheapless = "0.8.0"— stack-allocatedStringforwrite!formattingembedded-hal-0-2(alias forembedded-hal = "0.2") — required becauserp2040-hal 0.10ADC still uses theembedded_hal_0_2::adc::OneShottrait despite the project otherwise targeting embedded-hal 1.0Housekeeping
.gitignoreadded; pre-existing trackedtarget/artifacts removed from the treeOriginal prompt
🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.