Skip to content

Commit

Permalink
fix clock hand accuracy
Browse files Browse the repository at this point in the history
  • Loading branch information
mmMicky committed Aug 3, 2022
1 parent 5783ae0 commit 2980144
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 6 deletions.
16 changes: 14 additions & 2 deletions example/factory/factory.ino
Original file line number Diff line number Diff line change
Expand Up @@ -136,11 +136,23 @@ void go_to_sleep(void) {
esp_sleep_enable_ext0_wakeup((gpio_num_t)PIN_BTN_R, 0);
esp_light_sleep_start();
}

void print_chip_info(void)
{
Serial.print("Chip: ");
Serial.println(ESP.getChipModel());
Serial.print("ChipRevision: ");
Serial.println(ESP.getChipRevision());
Serial.print("Psram size: ");
Serial.print(ESP.getPsramSize() / 1024);
Serial.println("KB");
Serial.print("Flash size: ");
Serial.print(ESP.getFlashChipSize() / 1024);
Serial.println("KB");
}
void setup() {
Serial.begin(115200);
Serial.println("Hello T-QT");

print_chip_info();
pinMode(PIN_LCD_BL, OUTPUT);
pinMode(PIN_BAT_VOLT, ANALOG);
digitalWrite(PIN_LCD_BL, HIGH);
Expand Down
7 changes: 4 additions & 3 deletions example/factory/lvgl_gui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ void load_debug(lv_obj_t *src) {
text += "flash size:\n";
text += ESP.getFlashChipSize() / 1024 / 1024;
text += "MB\n";
text += "Heap size:\n";
text += (ESP.getHeapSize() / 1024);
text += "psram size:\n";
text += (ESP.getPsramSize() / 1024);
text += "kb\n";

lv_label_set_text(debug_label, text.c_str());
Expand All @@ -106,7 +106,8 @@ void update_sensor(lv_timer_t *timer) {

struct tm timeinfo;
if (getLocalTime(&timeinfo)) {
lv_img_set_angle(hour_img, ((timeinfo.tm_hour) * 300) % 3600);
// The line that fixes the hour hand. by: https://github.com/Xinyuan-LilyGO/T-QT/issues/5
lv_img_set_angle(hour_img, ((timeinfo.tm_hour) * 300 + ((timeinfo.tm_min) * 5)) % 3600);
lv_img_set_angle(min_img, (timeinfo.tm_min) * 60);

lv_anim_t a;
Expand Down
18 changes: 17 additions & 1 deletion example/factory/platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,20 @@ framework = arduino
platform_packages =
framework-arduinoespressif32@https://github.com/espressif/arduino-esp32.git#2.0.3

build_flags =
build_flags =
-DARDUINO_USB_MODE=1
-DARDUINO_USB_CDC_ON_BOOT=1
; -DBOARD_HAS_PSRAM

; board_build.partitions=default.csv
; board_build.mcu = esp32s3
; board_build.f_cpu = 240000000L
; board_build.arduino.memory_type = qspi_qspi
; board_build.flash_freq=120m
; board_build.flash_size =4MB
; board_build.flash_mode = dio
; board_build.boot=qio
; board_build.flash_type = qspi
; board_build.psram_type = qspi
; board_build.memory_type = qspi_opi
; board_build.boot_freq = 80m

0 comments on commit 2980144

Please sign in to comment.