Open
Conversation
Adds accelerometer-based freefall detection that cuts heater power and displays a warning when the iron is dropped or enters sustained freefall. Detection uses a slow IIR gravity reference (~3.2s time constant) to establish a stable 1g baseline independent of iron orientation. On each accelerometer sample the instantaneous magnitude is compared against this reference. A freefall event is declared when the total acceleration vector drops below 10% of normal gravity for 5 consecutive samples (~500ms), requiring genuine sustained weightlessness rather than brief motion spikes. When triggered, the heater is cut immediately and a 'Freefall Detected' screen is shown for 2.5 seconds before returning to the home screen. The warning can be dismissed early by pressing any button. To activate: Settings -> Advanced -> Freefall detect (toggle checkbox on) The feature is disabled by default. It requires a working accelerometer; if no accelerometer is detected at boot the setting has no effect.
Ralim
approved these changes
May 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds accelerometer-based freefall detection that cuts heater power when the iron is dropped, displaying a warning screen before returning to idle.
How it works
The MOV task maintains a slow IIR gravity reference (~3.2 second time constant) that tracks the stable 1g baseline regardless of how the iron is oriented. On each 100ms accelerometer sample, the instantaneous magnitude of the acceleration vector is compared against this reference. A freefall event is triggered when the total magnitude drops below 10% of normal gravity for 5 consecutive samples (~500ms), ensuring only genuine sustained weightlessness qualifies rather than normal wrist movements or brief bumps.
When triggered:
currentTempTargetDegC = 0)How to activate
The feature is disabled by default. To enable:
To disable, return to the same menu and toggle it off.
The setting has no effect if no accelerometer is detected at boot.
Files changed
source/Core/Threads/MOVThread.cpp— detection logic and slow gravity referencesource/Core/Threads/UI/logic/FreefallWarning.cpp— new warning screen mode (new file)source/Core/Threads/UI/logic/Soldering.cpp— freefall check in soldering modesource/Core/Threads/UI/logic/SolderingProfile.cpp— freefall check in profile modesource/Core/Threads/UI/logic/Sleep.cpp— freefall check while sleepingsource/Core/Threads/GUIThread.cpp— dispatch for newFreefallWarningmodesource/Core/Threads/UI/logic/OperatingModes.h—FreefallWarningmode enum valuesource/Core/Inc/Settings.h—FreefallDetectionsetting enum entrysource/Core/Inc/Translation.h—WarningFreefallDetectedstring +FreefallDetectionsettings indexsource/Core/Inc/main.hpp—freefallDetectedextern declarationsource/Core/Src/settingsGUI.cpp— Advanced menu entrysource/Settings/settings.yaml— setting definitionTranslations/translation_EN.json— English stringsTranslations/translations_definitions.json— schema definitions