MCPcopy Create free account
hub / github.com/SmingHub/Sming / timer1complete

Method timer1complete

tests/HostTests/modules/Timers.cpp:70–150  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

68 }
69
70 void timer1complete()
71 {
72 statusTimer.initializeMs<1000>([this]() {
73 bool done = false;
74 ++statusTimerCount;
75 // if(timer32_count == 6) {
76 if(activeTimerCount == 0) {
77 Serial.print("statusTimer expired: ");
78 Serial.println(statusTimer);
79 statusTimer.stop();
80 Serial.print("statusTimer stopped: ");
81 Serial.println(statusTimer);
82 done = true;
83 }
84
85 auto mem = MallocCount::getCurrent();
86 String s;
87 s += system_get_time();
88 s += " ";
89 s += String(statusTimer);
90 s += " fired, timercount = ";
91 s += activeTimerCount;
92 s += ", mem = ";
93 s += mem;
94 Serial.println(s);
95 Serial.println(longTimer);
96
97 if(done) {
98 MallocCount::enableLogging(false);
99 if(mem != memStart) {
100 Serial.print("mem != memStart, memStart = ");
101 Serial.println(memStart);
102#ifndef ARCH_ESP32
103 TEST_ASSERT(false);
104#endif
105 }
106 complete();
107 }
108 });
109 statusTimer.start();
110
111 Serial.println(statusTimer);
112
113 if(1) {
114 longTimer.setCallback([this]() {
115 --activeTimerCount;
116 auto ticks = Timer::Clock::ticks();
117 Serial.println(longTimer.toString());
118 Serial.print("Elapsed ticks = ");
119 Serial.println(ticks - longStartTicks);
120 Serial.println(_F("Finally done!"));
121 });
122 Serial << _F("longTimer.maxTicks = ") << longTimer.maxTicks() << endl;
123 longTimer.setIntervalMs<15000>();
124 longTimer.startOnce();
125 longStartTicks = Timer::Clock::ticks();
126 Serial << _F("longTimer.start = ") << longStartTicks << endl;
127 ++activeTimerCount;

Callers 1

timer1CallbackMethod · 0.95

Calls 14

getCurrentFunction · 0.85
enableLoggingFunction · 0.85
completeFunction · 0.85
printlnMethod · 0.80
startOnceMethod · 0.80
getIntervalMsMethod · 0.80
system_get_timeFunction · 0.50
StringClass · 0.50
printMethod · 0.45
stopMethod · 0.45
startMethod · 0.45
setCallbackMethod · 0.45

Tested by

no test coverage detected