Update timing to be more precise

This commit is contained in:
Tomislav Kopić 2024-06-12 08:24:23 +00:00
parent 6b5a3c3b48
commit 655220c68a

View File

@ -43,9 +43,9 @@ U8G2_SSD1306_128X64_NONAME_2_HW_I2C display(U8G2_R2);
U8G2_SSD1306_128X64_NONAME_2_HW_I2C display(U8G2_MIRROR);
#endif
#define PIN_BTN_L 12 // D6
#define PIN_BTN_L 15 // D6
#define PIN_BTN_M 13 // D7
#define PIN_BTN_R 15 // D8
#define PIN_BTN_R 12 // D8
//define PIN_BTN_SAVE 3
#define PIN_BUZZER 14 // D5
@ -81,10 +81,8 @@ static void hal_sleep_until(timestamp_t ts) {
delayMicroseconds(1000); // Delay for 1000 microseconds (1 millisecond)
} else if (remaining > 100) {
delayMicroseconds(100); // Delay for 100 microseconds
} else if (remaining > 10) {
delayMicroseconds(10); // Delay for 10 microseconds
} else if (remaining > 0) {
delayMicroseconds(1); // Delay for 1 microsecond
delayMicroseconds(10); // Delay for 10 microseconds
}
}
#endif
@ -349,7 +347,7 @@ void setup() {
tamalib_register_hal(&hal);
tamalib_set_framerate(TAMA_DISPLAY_FRAMERATE);
// Tamagochi clock init, if in game time goes too fast increase this value in increments of 16
tamalib_init(1002714);
tamalib_init(1002700);
#if defined(ENABLE_SAVE_STATUS) || defined(AUTO_SAVE_MINUTES) || defined(ENABLE_LOAD_STATE_FROM_EEPROM)
initEEPROM();