opendps
opendps copied to clipboard
DPS mode & Settings Screen
Hello everyone!
I hope you are all doing well. I recently wanted to rebuild OpenDPS for my devices but had some difficulty getting all my separate PRs to work in a satisfactory manner. I spent some time over the past couple days getting what I had working previously on the latest master branch as well as further refining the settings screen and some UI rendering to reduce visual glitchiness when changing screens.
Due to the fact that my previous PRs were never merged after sitting for a very long time and the dependencies between some of my desired changes, I've opted to merge my PRs into one instead. Hopefully those that are interested in trying out my DPS mode will have an easier time by being able to just merge one PR.
Features
DPS Mode (based on #166)
- Brings a similar interface to original firmware
- Constant Current (CC) and Constant Voltage (CV) mode icons
- Set and recall M1/M2 preset values for voltage, current, power output limit, and timer (hold M1 or M2 to recall, hold SET + M1 or M2 to set)
- Additional features in the 3rd line can be set by pressing and turning the rotary. These features include:
- Max power output limit (Over Power Protection)
- A timer (showing power-on duration or as a countdown timer)
- Watt-hour meter
Settings (based on #184)
In the settings screen, you may adjust:
- the brightness
- the update speed (for the DPS Mode screen)
- calibration values for ADC/DAC (negative values now supported!)
- reset all settings to default values
Popup messages when settings are saved or reset. Eg:
There are other changes in this PR that may require additional review by kanflo.
- Changes to uui such that not all UI elements will be forced redrawn
- Changes to the default font, from Ubuntu to NerdFont for legibility
- Makefile defaults to CC/CV screens off
- Modification of uui_number.c to support negative numbers, but this will only for small fonts
- Addition of uui_time to show time
- Additional events (required for rotary push & turn combo in the DPS mode screen)
I have tested this PR with most features enabled with the exception of serial/wifi connectivity. Everything appears as it should and seems to function OK. For my own purposes, I have been using is compiled with most features disabled:
make -C opendps flash -j 9 MODEL=DPS5005 INVERT_ENABLE=0 CC_ENABLE=0 CL_ENABLE=0 CV_ENABLE=0 POWER_COLORED=1 POWER_OFF_VISIBLE=1 THERMAL_LOCKOUT=0 SETTINGS_ENABLE=1 FUNCGEN_ENABLE=0 WDOG=1
Feedback is welcomed as always. Please feel free to cherry pick the desired changes to merge into this repo as I'm aware not all the changes here might be desirable to everyone.
That is one impressive PR. I will have a look at and make sure you did not spend all that time for nothing ;)
Hi, this is awesome! I have a slight issue with the presets not working. Used your make command and when setting a voltage+current and pressing set+m1/m2 it doesn't save it and skips back to m1 which is set to 0V 0A. Also long-pressing m2 goes to m1 0 0 Also when shutting down it forgets the last voltage - is it supposed to do that?
Many thanks Conor
Hi Conor,
I noticed the presets weren't working with my initial PR. The problem was the past data was saving with incorrect IDs and should have been fixed with commit d52b0f2. Did you test with that commit in place? If so, I'll try to replicate it on my end, though I haven't had issues with presets since that commit.
The screen should be saving the voltage+current values during the event_button_enable
event. This means the values should be written to when the on/off button is pressed. It does not write the values to flash as the values are changed in order to reduce writes to flash, but perhaps it's something that can be added as a setting option later. Does your DPS 'forget' its voltage/current setting if you hit the on/off button before disconnecting power?
Thanks for the feedback.
Cheers
Hi thanks for the fast reply! I just wiped the repo and pulled it to make sure and it still does not work - the preset and the saving of values on button press. Anything I have to watch out for when flashing?
Just to confirm the behavior you're experiencing, Conor: After setting a voltage+current value to something non-zero, when you hit set+m1 or set+m2, the values reset back to 0 with the m1 bar displayed?
There isn't anything to building/flashing and I doubt it's something that you're doing incorrectly. I'll try replicating your issue after erasing the flash again. I had it glitch out with similar behavior as you described during development and it's possible it's working for me because I had presets saved previously.
Also, I just noticed the automated build failed from a commit I made last weekend which pushed the program size over the available flash size. I'm sure there's lots of places to optimize which I'll do when I get some free time.
Yes this exactly what I experienced. Would you mind sending me a bin you compiled to exclude errors on my side?
I was able to replicate some of the mentioned issues after erasing the flash and then re-flashing again.
Could you please try again with opendps_DPS5005.zip or build from my latest commit on this PR. You can also clear the flash before reflashing in case that's an issue. Just remember to also re-flash the bootloader.
# openocd -f interface/stlink-v2.cfg -f target/stm32f1x.cfg &
# telnet localhost 4444
> halt
> stm32f1x mass_erase 0
Cheers.
Sorry for the late reply, saving the voltage and current after power off works now. when pressing m2 (or m1) + set it just switches to m1 or m2 respectively without saving as a preset.
Can someone build this for dps3005 for me pretty please? I dont have a build env setup for this at the moment.