UiMode Ui::Splashscreen(bool &reset_settings) { UiMode mode = UI_MODE_MENU; unsigned long start = millis(); unsigned long now = start; do { mode = UI_MODE_MENU; if (read_immediate(CONTROL_BUTTON_L)) mode = UI_MODE_CALIBRATE; if (read_immediate(CONTROL_BUTTON_R)) mode = UI_MODE_APP_SETTINGS; reset_settings = read_immediate(CONTROL_BUTTON_UP) && read_immediate(CONTROL_BUTTON_DOWN); now = millis(); GRAPHICS_BEGIN_FRAME(true); menu::DefaultTitleBar::Draw(); graphics.print("Ornaments & Crimes"); weegfx::coord_t y = menu::CalcLineY(0); graphics.setPrintPos(menu::kIndentDx, y + menu::kTextDy); graphics.print("[L] => Calibration"); if (UI_MODE_CALIBRATE == mode) graphics.invertRect(menu::kIndentDx, y, 128, menu::kMenuLineH); y += menu::kMenuLineH; graphics.setPrintPos(menu::kIndentDx, y + menu::kTextDy); graphics.print("[R] => Select app"); if (UI_MODE_APP_SETTINGS == mode) graphics.invertRect(menu::kIndentDx, y, 128, menu::kMenuLineH); y += menu::kMenuLineH; graphics.setPrintPos(menu::kIndentDx, y + menu::kTextDy); if (reset_settings) graphics.print("!! RESET EEPROM !!"); y += menu::kMenuLineH; graphics.setPrintPos(menu::kIndentDx, y + menu::kTextDy); graphics.print(OC_VERSION); weegfx::coord_t w; if (now - start < SPLASHSCREEN_DELAY_MS) w = 128; else w = ((start + SPLASHSCREEN_DELAY_MS + SPLASHSCREEN_TIMEOUT_MS - now) << 7) / SPLASHSCREEN_TIMEOUT_MS; graphics.drawRect(0, 62, w, 2); GRAPHICS_END_FRAME(); } while (now - start < SPLASHSCREEN_TIMEOUT_MS + SPLASHSCREEN_DELAY_MS); SetButtonIgnoreMask(); return mode; }
int main(void) { while (1) { refresh_inputs(); if (isSchedulable_done()) { done(); } else if (isSchedulable_write_value()) { int ports = 0; if (!FIFO_HAS_ROOM(decoder_parser_blkexp_OUT)(&fifo_o_decoder_parser_blkexp_OUT, 1)) { ports |= 0x01; } if (ports != 0) { continue; } write_value(); } else if (isSchedulable_write_zero()) { int ports = 0; if (!FIFO_HAS_ROOM(decoder_parser_blkexp_OUT)(&fifo_o_decoder_parser_blkexp_OUT, 1)) { ports |= 0x01; } if (ports != 0) { continue; } write_zero(); } else if ((decoder_parser_blkexp_RUN_tokens >= 1) && (decoder_parser_blkexp_VALUE_tokens >= 1) && (decoder_parser_blkexp_LAST_tokens >= 1) && isSchedulable_read_immediate()) { int ports = 0; if (!FIFO_HAS_ROOM(decoder_parser_blkexp_OUT)(&fifo_o_decoder_parser_blkexp_OUT, 1)) { ports |= 0x01; } if (ports != 0) { continue; } read_immediate(); } else if ((decoder_parser_blkexp_RUN_tokens >= 1) && (decoder_parser_blkexp_VALUE_tokens >= 1) && (decoder_parser_blkexp_LAST_tokens >= 1) && isSchedulable_read_save()) { int ports = 0; if (!FIFO_HAS_ROOM(decoder_parser_blkexp_OUT)(&fifo_o_decoder_parser_blkexp_OUT, 1)) { ports |= 0x01; } if (ports != 0) { continue; } read_save(); } else { continue; } } }