File tree Expand file tree Collapse file tree 2 files changed +10
-8
lines changed Expand file tree Collapse file tree 2 files changed +10
-8
lines changed Original file line number Diff line number Diff line change 24
24
* THE SOFTWARE.
25
25
*/
26
26
27
- #include <stdatomic.h>
28
-
29
27
#include "supervisor/shared/tick.h"
30
28
#include "supervisor/filesystem.h"
31
29
#include "supervisor/shared/autoreload.h"
32
30
33
- static atomic_bool tick_up ;
34
31
static volatile uint64_t ticks_ms ;
32
+ static volatile uint32_t background_ticks_ms32 ;
35
33
36
34
#if CIRCUITPY_GAMEPAD
37
35
#include "shared-module/gamepad/__init__.h"
@@ -47,8 +45,6 @@ void supervisor_tick(void) {
47
45
48
46
ticks_ms ++ ;
49
47
50
- atomic_store (& tick_up , true);
51
-
52
48
#if CIRCUITPY_FILESYSTEM_FLUSH_INTERVAL_MS > 0
53
49
filesystem_tick ();
54
50
#endif
@@ -82,7 +78,14 @@ uint32_t supervisor_ticks_ms32() {
82
78
extern void run_background_tasks (void );
83
79
84
80
void supervisor_run_background_tasks_if_tick () {
85
- if (atomic_exchange (& tick_up , false)) {
86
- run_background_tasks ();
81
+ uint32_t now32 = ticks_ms ;
82
+
83
+ if (now32 == background_ticks_ms32 ) {
84
+ return ;
87
85
}
86
+ background_ticks_ms32 = now32 ;
87
+
88
+ run_background_tasks ();
89
+ }
90
+
88
91
}
Original file line number Diff line number Diff line change 28
28
#define __INCLUDED_SUPERVISOR_TICK_H
29
29
30
30
#include <stdint.h>
31
- #include <stdatomic.h>
32
31
33
32
extern void supervisor_tick (void );
34
33
extern uint32_t supervisor_ticks_ms32 (void );
You can’t perform that action at this time.
0 commit comments