aboutsummaryrefslogtreecommitdiff
path: root/spaghetti-monster/fsm-adc.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Moved pseudo_rand() into its own header, and made it gather entropy from ADC ↵Selene ToyKeeper2018-06-231-0/+5
| | | | | | | | readings to improve randomness. Adjusted candle mode to use lower bits instead of upper bits, because the lower bits are more random. (also, the lower-bit method is slightly smaller in ROM)
* Made voltage ADC readings work on pin7 if USE_VOLTAGE_DIVIDER is defined.Selene ToyKeeper2018-05-011-9/+39
|
* FSM: added ability to adjust temperature calibration in UI (lower-case ↵Selene ToyKeeper2018-01-241-1/+1
| | | | therm_cal_offset var).
* Work around issues related to ADC interrupt auto-triggering itself.Selene ToyKeeper2018-01-241-8/+17
| | | | | | (was firing off 1000 times faster than desired, causing several issues) (now only executes when explicitly requested by the WDT)
* Updated more temperature bits to be 14.1 instead of 13.2.Selene ToyKeeper2017-10-061-3/+3
|
* Slightly increased resolution of VOLTAGE_FUDGE_FACTOR.Selene ToyKeeper2017-09-221-1/+2
| | | | | | My lights seemed to measure just a bit low, so hopefully this will help. It bumps up reported values by 0.05V.
* Adjusted thermal regulation based on results of some handheld runtime tests.Selene ToyKeeper2017-09-101-2/+2
| | | | | | It was bouncing before, and now it's not. (cut response magnitude in half, increased width of null zone)
* Made thermal regulation slightly more prediction-heavy, less noisy at stable ↵Selene ToyKeeper2017-09-101-8/+11
| | | | | | | | | | | state, and slightly smaller. Added a bit of overflow protection since I think I saw it overflow with the prediction weight increased. Uses immediate temperature (instead of avg) for lowpass reset, to make it less noisy at stable state. (more trigger-happy reset switch biases it toward inaction) Avoid using volatile var, to reduce space. Overflow prevention also caps the maximum adjustment step, which should slightly help prevent overshooting the target.
* Reworked thermal regulation.Selene ToyKeeper2017-09-091-31/+54
| | | | | | | | | | | | | | | | Now actually works on turbo (was previously emitting "temp low" instead of "temp high" while in direct-drive, probably due to an overflow). Made stepdown work based on an average of the last few temperature predictions instead of just the most recent one. (reduced noise sensitivity) Made each temperature sample based on 8 measurements instead of 4, to reduce noise. Made standby mode re-init thermal measurement arrays, to avoid weird behavior next time light is used. Reduced fixed-point precision to avoid overflows. Reduced prediction strength to encourage stepping down faster while hot. (unfortunately also steps down later, I think, if it wasn't already hot) Not totally happy with new algorithm, but it's the least crappy of a whole bunch of things I tried. (for example, a PID approach with correction based mostly on I... didn't work very well) (taking an average of the last few predictions is very similar though, and works) (but the result is still kind of meh) Saving this so I'll have a functional base next time I try to improve it.
* Started a Meteor M43 clone UI.Selene ToyKeeper2017-08-311-0/+5
| | | | | | | So far, UI1 and battcheck both work. UI2 and UI3 and other blinkies aren't implement yet. Added 6-bar battcheck style to match Meteor (ish). Increased maximum number of clicks to 12, because WTF. If your UI needs 12 clicks, what are you even doing in life?
* Avoid suspending at weird times by deferring the call to standby mode.Selene ToyKeeper2017-08-261-0/+4
| | | | | | Turned strobe into a function to avoid repeating code, and made it tolerate interruption better. Got rid of delay after battcheck, since it caused problems if the user didn't wait long enough before trying to turn the light back on.
* Made 4bar and 8bar battcheck styles work.Selene ToyKeeper2017-08-251-2/+3
| | | | | Added LVP handling for other modes, including battcheck.
* Added battcheck mode to ramping-ui. It's bigger than I had hoped. :(Selene ToyKeeper2017-08-251-0/+24
| | | | | | Added fsm-misc.*, which currently only has interruptible blink functions in it. (for blinking out numbers and such)
* Don't send underheat warnings when LVP is active. The signals conflict.Selene ToyKeeper2017-08-241-5/+5
| | | | Also, avoid immediate thermal step-down after battery change. (init array with correctly-scaled values)
* Added a ramping UI example.Selene ToyKeeper2017-08-241-0/+2
| | | | | Added ramping support in general.
* Added thermal regulation to SpaghettiMonster / Baton.Selene ToyKeeper2017-08-231-4/+132
| | | | | | Made some LVP values configurable. Removed high_temperature() / low_temperature() shortcuts for now.
* Completely reorganized SpaghettiMonster code into smaller logical pieces: ↵Selene ToyKeeper2017-08-191-0/+136
fsm-*.c and fsm-*.h.