File tree Expand file tree Collapse file tree 3 files changed +24
-4
lines changed Expand file tree Collapse file tree 3 files changed +24
-4
lines changed Original file line number Diff line number Diff line change 29
29
* How many seconds/minutes we wait until going to sleep/shutdown.
30
30
* Values -> SLEEP_TIME * 10; i.e. 5*10 = 50 Seconds!
31
31
*/
32
- #define SLEEP_TIME 5 // x10 Seconds
33
- #define SHUTDOWN_TIME 10 // Minutes
32
+ #define SLEEP_TIME 5 // x10 Seconds
33
+ #define SHUTDOWN_TIME 0 // Minutes -- Default shutdown to being off
34
34
35
35
/**
36
36
* Auto start off for safety.
Original file line number Diff line number Diff line change @@ -159,6 +159,9 @@ void startMOVTask(void const *argument __unused) {
159
159
int16_t tx = 0 , ty = 0 , tz = 0 ;
160
160
int32_t avgx, avgy, avgz;
161
161
Orientation rotation = ORIENTATION_FLAT;
162
+ #ifdef ACCEL_EXITS_ON_MOVEMENT
163
+ uint16_t tripCounter = 0 ;
164
+ #endif
162
165
for (;;) {
163
166
int32_t threshold = 1500 + (9 * 200 );
164
167
threshold -= getSettingValue (SettingsOptions::Sensitivity) * 200 ; // 200 is the step size
@@ -197,10 +200,23 @@ void startMOVTask(void const *argument __unused) {
197
200
// than the threshold
198
201
199
202
// If movement has occurred then we update the tick timer
200
- if (error > threshold) {
203
+ bool overThreshold = error > threshold;
204
+ #ifdef ACCEL_EXITS_ON_MOVEMENT
205
+ if (overThreshold) {
206
+ tripCounter++;
207
+ if (tripCounter > 2 ) {
208
+ lastMovementTime = xTaskGetTickCount ();
209
+ }
210
+ } else if (tripCounter > 0 ) {
211
+ tripCounter = 0 ;
212
+ }
213
+ #else
214
+ if (overThreshold) {
201
215
lastMovementTime = xTaskGetTickCount ();
202
216
}
203
217
218
+ #endif
219
+
204
220
vTaskDelay (TICKS_100MS); // Slow down update rate
205
221
}
206
222
}
Original file line number Diff line number Diff line change @@ -94,8 +94,10 @@ bool checkExitSoldering(void) {
94
94
// If we have moved recently; in the last second
95
95
// Then exit soldering mode
96
96
97
- if (((TickType_t)(xTaskGetTickCount () - lastMovementTime)) < (TickType_t)(TICKS_SECOND)) {
97
+ // Movement occurred in last update
98
+ if (((TickType_t)(xTaskGetTickCount () - lastMovementTime)) < (TickType_t)(TICKS_SECOND / 5 )) {
98
99
currentTempTargetDegC = 0 ;
100
+ lastMovementTime = 0 ;
99
101
return true ;
100
102
}
101
103
}
@@ -108,6 +110,8 @@ bool checkExitSoldering(void) {
108
110
if (shouldShutdown ()) {
109
111
// shutdown
110
112
currentTempTargetDegC = 0 ;
113
+ lastMovementTime = xTaskGetTickCount (); // We manually move the movement time to now such that shutdown timer is reset
114
+
111
115
return true ; // we want to exit soldering mode
112
116
}
113
117
#endif
You can’t perform that action at this time.
0 commit comments