PTDreamer / stm32_soldering_iron_controller

Custom firmware for the chinese ksger soldering iron controller
GNU Lesser General Public License v3.0
166 stars 71 forks source link

Show supply voltage for battery operation #3

Open StefanTrethan opened 6 years ago

StefanTrethan commented 6 years ago

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.

PTDreamer commented 6 years ago

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.

StefanTrethan commented 6 years ago

Hi Jose,

I noticed that the new version of the controller by KSEGER already has the voltage functions I want: https://ru.aliexpress.com/store/product/STM32-2-1S-OLED-T12-Solder-Iron-Temperature-Controller-Welding-Tools-Electronic-Soldering-Wake-Sleep-Shock/1486111_32788912011.html?spm=a2g0x.12010608.0.0.7b6971f32X6dEe

Battery version: https://de.aliexpress.com/store/product/KSGER-Soldering-Iron-Station-OLED-T12-Tips-STM32-V3-0-DIY-Kits-FX9501-Electric-Tools-Lithium/1486111_32848362100.html?spm=a2g0x.12010615.0.0.2600678aRDSfWO

This listing has a table showing the different newer versions: https://de.aliexpress.com/store/product/STM32-OLED-DIY-Kits-T12-Solder-Electronic-Soldering-Welding-Iron-Tips-Temperature-Controller-Wake-Sleep-Shock/1486111_32790819535.html?spm=a2g0x.12010615.0.0.1887293f7EIut2

But I want to use the JBC iron so stock software is probably no option for me?

Meanwhile I got the ST system workbench to run. I noticed you already have a routine to read supply voltage. I expect I might be able to add this feature by myself, but it will be a messy bodge because I do not understand many things you did and this is my first STM controller.

Since the new boards are only $17, which is considerably cheaper than the $27 I paid for the exact model you used, I'm not sure how much sense it makes to continue development for that old board. I mean perhaps your software will run fine in the new boards, but if not someone will have to port it or it will become obsolete pretty soon.

I will probably bring the 4 programming pins out with a connector so I can make changes to the software later. Today I will try to modify your software myself, we will see how long it takes until I break it completely. ;-)

ST

On Thu, Jun 7, 2018 at 10:30 PM, Jose Barros notifications@github.com wrote:

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.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/PTDreamer/stm32_soldering_iron_controller/issues/3#issuecomment-395554612, or mute the thread https://github.com/notifications/unsubscribe-auth/AmIzGnd_yxdgK-29QllaHxOdS-1R8FFFks5t6Y1bgaJpZM4UcZBd .

StefanTrethan commented 6 years ago

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;
PTDreamer commented 6 years ago

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.