PTDreamer/stm32_soldering_iron_controller

Show supply voltage for battery operation

Opened this issue · 4 comments

It would be nice for battery operation if the supply voltage could optionally be shown on the display.
Ideally there would also be an adjustable low voltage warning or shutdown via the menu.

Hi, thank you for opening this issue.

The main problem I have to continue to develop this firmware is that both my stations (JBC and Hakko) are being used daily and inside a case.
I have sent a message to kseger oficial seller on aliexpress to see if they are willing to donate a new controller.
If anyone is willing to develop this I can give a few pointers or even write some snippets.

So I managed to add the voltage readout (I put it between the tip number and ambient temperature).
I had to correct the scaling from 3300 to 2833 but now it is perfect.

I'm not sure if I should mess with a low battery warning, or with adding menu functions.
It feels like I am way out of my depth and I should be very glad I got this far without blowing up your code. You see I am the kind of "programmer" that gets extremely uneasy at the use of pointers.

For now, I think this is good enough, but maybe I will feel like breaking it some more later.
I even found your switches for JBC and the large display, I am very proud of that.

Thanks again for providing this very useful software to us!

Stefan

This is what I added to main_screen.c:
(Let me know if I should send you the file)

static void * main_screen_getSupplyVoltage_mv() { // STR
temp = getSupplyVoltage_mv() / 10;
return &temp;
}

//Supply voltage display // STR
widget = screen_addWidget(scr);
widgetDefaultsInit(widget, widget_display);
widget->posX = 35;
widget->posY = 50;
widget->font_size = &FONT_8X14;
widget->displayWidget.getData = &main_screen_getSupplyVoltage_mv;
widget->displayWidget.number_of_dec = 1;
widget->displayWidget.type = field_uinteger16;
widget->reservedChars = 4;


//Supply voltage V symbol // STR
widget = screen_addWidget(scr);
widgetDefaultsInit(widget, widget_label);
char *v = "V";
strcpy(widget->displayString, v);
widget->posX = 67;
widget->posY = 50;
widget->font_size = &FONT_8X14;
widget->reservedChars = 1;
widget->draw = &default_widgetDraw;

Hi,

Congrats on the new feature coding!
Ideally you would send a pull request for this. You can use a gui like GitKraken if you are not comfortable with git. I can guide trough it if you want, and also help you with other features you want to add.
That is if you are interested in learning this things, if not I can just copy the code above and add it myself.