Ralim / IronOS

Open Source Soldering Iron firmware
https://ralim.github.io/IronOS/
GNU General Public License v3.0
7.29k stars 724 forks source link

TS100 wont go into timed sleep or shutdown #366

Closed 3dBu closed 4 years ago

3dBu commented 6 years ago

Steps to reproduce:

  1. Power iron
  2. Turn it on
  3. Don't move it
  4. Wait for timed sleep & shutdown
jonnieZG commented 6 years ago

It has not been working since v2.05. I had to revert back to v2.04.1.

Ralim commented 6 years ago

Can you please detail which firmware version you are using, and sensitivity, and what the M count in the debug menu does when both moving and not moving your iron, and what PCB model you have in the debug menu ?

I still have no irons that reproduce this issue.

jonnieZG commented 6 years ago

It says V2.05 PCB1. Move counter keeps on counting seconds, the same as Time, no matter if I move it or not, no matter what the sensitivity value is.

Ralim commented 6 years ago

Which language / exactly which file ? Cant reproduce this on either of my PCB1 boards on 2.05 / 2.05.01

jonnieZG commented 6 years ago

Tried with HR and EN too, neither does not work.

I stress that v2.04.1 does work.

3dBu commented 6 years ago

EN language for me too.

jonnieZG commented 6 years ago

I have not tested it (and I won't get to any time soon), but the problem was introduced somewhere after the commit 4718efe79bfcebb91cf09a6331974938989d3230. There were many changes regarding the movements sensor in the commit 215fe8e9e84b8d5af4955d77f372957b68771331 and I bet that was the moment when the things went south.

BWT, perhaps you might consider using the EWMA filter for smoothing accelerometer readings rather than buffering last 8 readings: https://github.com/jonnieZG/EWMA, since it uses less memory and is much faster

Ralim commented 6 years ago

@jonnieZG I agree that those points may have introduced errors, though they all theoretically act the same way, how they play with compiler optimizations will be different.

Please feel free to submit a pull request for EWMA if you get time. (Integer fixed point based please, float chews up more flash than there is spare often)

jonnieZG commented 6 years ago

Oh, and also this: you absolutely should be using the volatile keyword in definitions of all global variables that are modified by another OS thread. It prevents the optimizer from doing stupid things with variables that are being shared between several threads!

Ralim commented 6 years ago

As far as i know that should be done, I am well aware of that. I'll have to double check if others merges have undone it.

It's not should, but have to.

On the only except is when there is a single writer and a single reader

jonnieZG commented 6 years ago

@Ralim, I have just added a template for this filter to https://github.com/jonnieZG/EWMA, called EwmaT, that does not use any floating-pointh maths. You can use it like this (the alpha and alphaScale values have to be empirically determined):

#include "EwmaT.h"
...
EwmaT<uint32_t> ewmaX(alpha, alphaScale);
EwmaT<uint32_t> ewmaY(alpha, alphaScale);
EwmaT<uint32_t> ewmaZ(alpha, alphaScale);
...
filteredX = ewmaX.filter(tx);
filteredY = ewmaY.filter(ty);
filteredZ = ewmaZ.filter(tz);
...
jonnieZG commented 6 years ago

Adding raw accelerometer X, Y and Z readings to the debug menu might cast some light onto the case...

nmaggioni commented 6 years ago

I'm having the same issue, and the debug values are the same as above.

I've bisected the commits between v2.04.1 and v2.05, and the problem begun to appear in commit 215fe8e indeed. Further testing shows that the problematic commit is 030a714.

@3dBu, @jonnieZG would you mind trying out this build I've made? It is v2.05.01 with 030a714 reverted - it works for me: TS100_EN.zip

Ralim commented 6 years ago

@nmaggioni Could you confirm if the master branches fix in f4e2 helps for this ?

nmaggioni commented 6 years ago

@Ralim It seems to be solved indeed! Thanks for the quick fix.

Ralim commented 6 years ago

Thanks for checking, stupid typo that your bisection made easy to find.

jonnieZG commented 5 years ago

Solved as of v2.06. Please close.

haarp commented 5 years ago

Is it really solved? I flashed 2.06rc5 on my iron which I just received the other day, and it will not go into sleep or shutdown at all. Even setting sensitivity to 0 (supposedly off) doesn't help. The move counter keeps ticking no matter how still the iron is.

Ralim commented 5 years ago

@haarp Turning sensitivity off stops the system working with the IMU, and instead forces the counter to increment so the iron doesn't sleep (as otherwise you have no means to stop it sleeping during soldering).

What PCB model is your iron showing up as ? What sensitivity levels have you tried ?

haarp commented 5 years ago

Ah, I see, I'll avoid 0 then. Just for the record, automatic display orientation does work, so the accelerometer msut be functional. Running on an old 16V Thinkpad power supply.

What PCB model is your iron showing up as ?

According to the debug menu: Model: 1 (btw. once I reach Tres in the debug menu, it stops responding to input)

What sensitivity levels have you tried ?

From default 7 all the way down to 1.

Thanks for taking your time for this!

jakester21 commented 5 years ago

im having the same problem just updated to the latest firmware and the seconds never count down and im at default sensitivity

Ralim commented 5 years ago

@jakester21 If you are talking about the debug menu: Not counting down is ok, as its a timestamp. So when movement is detected the value should increment, and when its sitting still it should keep the same number.

jakester21 commented 5 years ago

ok but it does not go to sleep the temp always stay at the temp i set it to and it does not shut down after the time i set but the v2.4.1 seems to work

fseuhs commented 5 years ago

I have the same problem with a brand new TS100. No shutdown and sleep with v2.06-RC5 and v2.05.01, I tested! v2.04.1 works well. Regards

andreisandor commented 5 years ago

I had the same problem with v2.06-RC5, the device wouldn't go to sleep/shutdown (tried different motion sensitivities). I've also tried v2.06-RC4 and it work's fine with this version. I just got the device (1 hour ago) so still trying to figure it out hot to access Debug menu in order to provide more info.

LE: Found the debug menu and i have Model 1. I flashed again 2.06-RC5, tried different Motion sensitivities (0, 4,6,9) and I've looked in the debug menu at Move. It seems that the moves increments every second regardless of the motion sensitivity value. The move increments works fine in 2.06-RC4 version.

yakimka commented 5 years ago

I have the same problem with a brand new TS100. The device wouldn't go to sleep. "Move" in debug menu ticking like seconds. Once I reach "Tres" in the debug menu, it stops responding.

Firmware Version: v2.06-RC5 Model: 1 Power Supply: 24V 3A

PS. On 2.06-RC4 sleep works

Ralim commented 5 years ago

This is looking like a bug in the older acceleromter model used in the PCB 1 rev units.

I do have one of these daughter boards "somewhere" that I need to track down to solve this.

Sorry to be so absent these days, just really dont have much time these days.

Could someone confirm if automatic screen rotation is working for them?

Suspect file is here : https://github.com/Ralim/ts100/blob/master/workspace/TS100/Core/Src/MMA8652FC.cpp

yakimka commented 5 years ago

Yes, automatic screen rotation is working for me in 2.06-RC5

th3Al3xander commented 5 years ago

I can confirm the bug Version 2.06

stuartm commented 5 years ago

Hardly seems necessary to add yet another report, but on the basis that more data points can help confirm/debug, I'm seeing this issue on a 'brand new' iron with 2.06-RC5 flashed, Model 1 using a 19v supply. Auto-rotation works (though I turned it off) but movement value climbs at a regular rate (1 per second approx).

If I get time I'll do a binary search and try to identify the commit.

Firebie commented 5 years ago

How to compile latest sources on Windows? I was using Atollic, but now, when I try to compile, I have "Nothing to build for project TS100", when I open project properties - "Orphaned configuration. No base extension cfg exists for com.st.stm32cube.ide.mcu.gnu.managedbuild.config.exe.release.980996604".

evgazloy commented 5 years ago

Confirm. 2.06-RC5. automatic screen rotation doesn't work either.

Neposedaua commented 5 years ago

v2.06-RC5, the device wouldn't go to sleep/shutdown (tried different motion sensitivities). Confirm.

Saschko2000 commented 5 years ago

v2.05.01. I have two devices. One works like a charme, the other will not go in sleep mode. Both have the same Firmware. I have no idea :-(

Ralim commented 5 years ago

TS100_temp_3fea.zip

Heya, This is a build from my branch that I'm working on for some better temperature calibration/temp curve work.

Could you please use the debug menu to see if the move timer is working for you in this version? Also, as this is from my temp branch, would love if i could crowd source some data from you all :grin: -> Please do a temperature calibration in the menu. This is done by letting the tip and handle come into temp equilibrium (ie, leave on desk and ignore for an hour). Then power up the unit, and go into the Settings menu > Advanced > Temperature calibration > press the front button (for OK). Then it will dance " . . . . " (about 1.5 seconds). Then show a checkbox and a 4 digit number.

Would be wonderful if you could post back your tip type and the 4 digit number. Hopefully most are around 700-900 range if my maths works out :D

NOTE: -> This version may not have perfect temp calibration atm (though i hope its moderately close). -> Should have some minor fixes for quality of life stuff like the power estimator too. -> Might be better at temp control depending on your tip. -> Built from git tag 3fea95c

If you find the temp control is way off, let me know.

th3Al3xander commented 5 years ago

Engish is my 2nd language, so im sorry in advance if i make mistakes

Could you please use the debug menu to see if the move timer is working for you in this version?

If i move the ts 100 it counts upward, if i dont move it it stops counting

-> Please do a temperature calibration in the menu. This is done by letting the tip and handle come into temp equilibrium (ie, leave on desk and ignore for an hour). Then power up the unit, and go into the Settings menu > Advanced > Temperature calibration > press the front button (for OK). Then it will dance " . . . . " (about 1.5 seconds). Then show a checkbox and a 4 digit number.

it says 673

Thanks for supporting and making the software

ggc161169 commented 5 years ago

I had the same problem, but I solved installing the version 2.04, then the 2.05 (nmaggioni) and then the 2.06 RC4 ... without problems so far.

Ralim commented 5 years ago

@th3Al3xander Thank you, you did exactly what I wanted. Looks like accelerometer is working for you (at least).

Also, that calibration number looks good, which is promising :) An offset of ~600uV sounds about right for the ADC + resistor calibrations.

Need to re-calculate some curves but this is promising

Firebie commented 5 years ago

Small patch for undervoltage "V" symbol: https://gist.github.com/Firebie/f4c1d5b8519c706fae8b583e8ab0aef0

Yourigh commented 5 years ago

TS100_temp_3fea.zip

Could you please use the debug menu to see if the move timer is working for you in this version?

Timer is working well as well as sleep.

-> Please do a temperature calibration in the menu. This is done by letting the tip and handle come into temp equilibrium (ie, leave on desk and ignore for an hour). Then power up the unit, and go into the Settings menu > Advanced > Temperature calibration > press the front button (for OK). Then it will dance " . . . . " (about 1.5 seconds). Then show a checkbox and a 4 digit number.

It shows 0753 on tip TS-B2 It shows 0827 on tip TS-ILS

Also turning of by pressing both buttons is much easier as in 2.04. Thank you!

Ralim commented 5 years ago

Awesome!

Thank you everyone for testing this.

Any general feedback on stability of the firmware ^

I need to make up a new test jig to calibrate the temp curve but then aiming to merge that into master and get a release out.