MCPcopy Create free account
hub / github.com/PricelessToolkit/MailBoxGuard / update

Method update

Code/Arduino_libraries/SSD1306/OLEDDisplayUi.cpp:228–253  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

226}
227
228int16_t OLEDDisplayUi::update(){
229#ifdef ARDUINO
230 unsigned long frameStart = millis();
231#elif __MBED__
232 Timer t;
233 t.start();
234 unsigned long frameStart = t.read_ms();
235#else
236#error "Unkown operating system"
237#endif
238 int32_t timeBudget = this->updateInterval - (frameStart - this->state.lastUpdate);
239 if ( timeBudget <= 0) {
240 // Implement frame skipping to ensure time budget is kept
241 if (this->autoTransition && this->state.lastUpdate != 0) this->state.ticksSinceLastStateSwitch += ceil((double)-timeBudget / (double)this->updateInterval);
242
243 this->state.lastUpdate = frameStart;
244 this->tick();
245 }
246#ifdef ARDUINO
247 return this->updateInterval - (millis() - frameStart);
248#elif __MBED__
249 return this->updateInterval - (t.read_ms() - frameStart);
250#else
251#error "Unkown operating system"
252#endif
253}
254
255
256void OLEDDisplayUi::tick() {

Callers

nothing calls this directly

Calls 3

tickMethod · 0.95
millisFunction · 0.85
startMethod · 0.45

Tested by

no test coverage detected