myvobot / dock-mini-apps

Apps for Vobot Dock Mini
MIT License
8 stars 3 forks source link

unable to get NTP time #2

Closed lcervo closed 4 months ago

lcervo commented 4 months ago

Hi, I am developing my own app therefore I am rebooting the vobot many times. Every so often I am getting the following error that forces me to reboot the device again.

D (3692) NTP: sync time from: pool.ntp.org I (3702) wifi:idx:1 (ifx:0, e6:b3:70:f2:bf:f6), tid:6, ssn:2, winSize:64 E (10701) NTP: unable to get NTP time Traceback (most recent call last): File "core/nwk/ntp.py", line 53, in _ntp OSError: -202 D (10702) NTP: wait 3s

Is it something I can do to prevent this to happen?

pumpkin-zbh commented 4 months ago

From your description and the provided log snippet, it appears that the error occurs during the NTP time synchronization process. This issue is likely due to temporary network problems, such as network fluctuations or disconnections, which cause the NTP request to fail intermittently.

However, please note that our system includes a retry mechanism that will automatically attempt to synchronize the time again after a short delay. This means that even if the initial attempt to get the NTP time fails, the system should eventually succeed in obtaining the correct time without requiring a manual reboot.

To better understand and assist with this issue, could you please provide us with the following additional information:

  1. The complete log file, so we can analyze the sequence of events leading up to the error.
  2. Confirmation on whether other HTTP interfaces are functioning correctly after this error occurs.
lcervo commented 4 months ago

hi, this is the log dump:

MPY: soft reboot MP boot @38878ms prepare paths D (39084): Loading config C (39090): Start VOBOT v1.0.4 VOBOT-PRD REV2 D (39107) DEVMON: device monitor started D (39109): asyncio loop forever D (39110) DH: Dock Hub Start init: I2C(0, scl=18, sda=17, freq=80000) I (39283) BUZZER: buzzer init ~D (39319) CFGPRJ: Project ConfigMgr init init CH455 init: UART(2, baudrate=19200, bits=8, parity=1, stop=1, tx=8, rx=-1, rts=-1, cts=-1, txbuf=0, rxbuf=129, timeout=0, timeout_char=0) I (39457) NET: network init W (39579) DH: NFC not enabled D (39587) CACT: check action init Double buffer 19200 ESP-ROM:esp32s3-20210327 Build:Mar 27 2021 rst:0x8 (TG1WDT_SYS_RST),boot:0x2a (SPI_FAST_FLASH_BOOT) Saved PC:0x420b6613 SPIWP:0xee mode:DIO, clock div:1 load:0x3fce3810,len:0x1784 load:0x403c9700,len:0x4 load:0x403c9704,len:0x1048 load:0x403cc700,len:0x3004 entry 0x403c9954 I (26) boot: ESP-IDF v5.2.1 2nd stage bootloader I (26) boot: compile time Jun 19 2024 17:47:27 W (26) boot: Unicore bootloader I (29) boot: chip revision: v0.2 I (33) qio_mode: Enabling default flash chip QIO I (38) boot.esp32s3: Boot SPI Speed : 80MHz I (43) boot.esp32s3: SPI Mode : QIO I (48) boot.esp32s3: SPI Flash Size : 8MB W (53) boot.esp32s3: PRO CPU has been reset by WDT. W (58) boot.esp32s3: APP CPU has been reset by WDT. I (64) boot: Enabling RNG early entropy source... I (69) boot: Partition Table: I (73) boot: ## Label Usage Type ST Offset Length I (80) boot: 0 nvs WiFi data 01 02 00009000 00004000 I (87) boot: 1 otadata OTA data 01 00 0000d000 00002000 I (95) boot: 2 phy_init RF data 01 01 0000f000 00001000 I (102) boot: 3 factory factory app 00 00 00010000 000d0000 I (110) boot: 4 ota_0 OTA app 00 10 000e0000 00620000 I (117) boot: 5 vfs Unknown data 01 81 00700000 00100000 I (125) boot: End of partition table I (129) esp_image: segment 0: paddr=000e0020 vaddr=3c1f0020 size=11cd94h (1166740) map I (315) esp_image: segment 1: paddr=001fcdbc vaddr=3fc9e800 size=0325ch ( 12892) load I (317) esp_image: segment 2: paddr=00200020 vaddr=42000020 size=1e8a10h (2001424) map I (624) esp_image: segment 3: paddr=003e8a38 vaddr=3fca1a5c size=0375ch ( 14172) load I (627) esp_image: segment 4: paddr=003ec19c vaddr=40374000 size=1a7bch (108476) load I (650) esp_image: segment 5: paddr=00406960 vaddr=500007f8 size=00808h ( 2056) load I (651) esp_image: segment 6: paddr=00407170 vaddr=600fe000 size=0003ch ( 60) load I (667) boot: Loaded app from partition at offset 0xe0000 I (668) boot: Disabling RNG early entropy source... I (668) cpu_start: Multicore app I (672) octal_psram: vendor id : 0x0d (AP) I (677) octal_psram: dev id : 0x02 (generation 3) I (683) octal_psram: density : 0x03 (64 Mbit) I (688) octal_psram: good-die : 0x01 (Pass) I (693) octal_psram: Latency : 0x01 (Fixed) I (699) octal_psram: VCC : 0x01 (3V) I (704) octal_psram: SRF : 0x01 (Fast Refresh) I (709) octal_psram: BurstType : 0x01 (Hybrid Wrap) I (715) octal_psram: BurstLen : 0x01 (32 Byte) I (721) octal_psram: Readlatency : 0x02 (10 cycles@Fixed) I (727) octal_psram: DriveStrength: 0x00 (1/1) I (733) MSPI Timing: PSRAM timing tuning index: 5 I (737) esp_psram: Found 8MB PSRAM device I (742) esp_psram: Speed: 80MHz I (755) cpu_start: Pro cpu start user code I (755) cpu_start: cpu freq: 240000000 Hz I (755) cpu_start: Application information: I (755) cpu_start: Compile time: Jun 7 2024 14:21:53 I (755) cpu_start: ELF file SHA256: 855373051... I (755) cpu_start: ESP-IDF: v5.2.1 I (755) cpu_start: Min chip rev: v0.1 I (756) cpu_start: Max chip rev: v0.99 I (756) cpu_start: Chip rev: v0.2 I (756) heap_init: Initializing. RAM available for dynamic allocation: I (756) heap_init: At 3FCB3D58 len 000359B8 (214 KiB): RAM I (756) heap_init: At 3FCE9710 len 00005724 (21 KiB): RAM I (757) heap_init: At 3FCF0000 len 00008000 (32 KiB): DRAM I (757) heap_init: At 600FE03C len 00001FAC (7 KiB): RTCRAM I (757) esp_psram: Adding pool of 8192K of PSRAM memory to heap allocator I (758) spi_flash: detected chip: gd I (758) spi_flash: flash io: qio W (758) rmt(legacy): legacy driver is deprecated, please migrate to driver/rmt_tx.h and/or driver/rmt_rx.h W (758) i2c: This driver is an old driver, please migrate your application code to adapt driver/i2c_master.h I (759) sleep: Configure to isolate all GPIO pins in sleep state I (759) sleep: Enable automatic switching of GPIO sleep configuration I (759) coexist: coex firmware version: 77cd7f8 I (760) coexist: coexist rom version e7ae62f I (760) main_task: Started on CPU0 I (761) esp_psram: Reserving pool of 32K of internal memory for DMA/internal allocations I (761) main_task: Calling app_main() I (769) main_task: Returned from app_main() I (769) MAIN: MP Task Heap Size=0x426843 Addr=0x3c310a88 Stack Size=0x8000 MP boot @774ms prepare paths D (957): Loading config C (963): Start VOBOT v1.0.4 VOBOT-PRD REV2 D (979) DEVMON: device monitor started D (981): asyncio loop forever D (982) DH: Dock Hub Start I (991) modsocket: Initializing init: I2C(0, scl=18, sda=17, freq=80000) I (1146) BUZZER: buzzer init ~D (1180) CFGPRJ: Project ConfigMgr init init CH455 I (1196) uart: ALREADY NULL init: UART(2, baudrate=19200, bits=8, parity=1, stop=1, tx=8, rx=-1, rts=-1, cts=-1, txbuf=0, rxbuf=129, timeout=0, timeout_char=0) I (1314) NET: network init I (1315) pp: pp rom version: e7ae62f I (1316) net80211: net80211 rom version: e7ae62f I (1317) wifi:wifi driver task: 3fccd768, prio:23, stack:6656, core=0 I (1318) wifi:wifi firmware version: a9f5b59 I (1318) wifi:wifi certification version: v7.0 I (1318) wifi:config NVS flash: disabled I (1318) wifi:config nano formating: disabled I (1319) wifi:Init data frame dynamic rx buffer num: 32 I (1319) wifi:Init static rx mgmt buffer num: 5 I (1319) wifi:Init management short buffer num: 32 I (1319) wifi:Init static tx buffer num: 16 I (1320) wifi:Init tx cache buffer num: 32 I (1320) wifi:Init static tx FG buffer num: 2 I (1320) wifi:Init static rx buffer size: 1600 I (1320) wifi:Init static rx buffer num: 16 I (1320) wifi:Init dynamic rx buffer num: 32 I (1321) wifi_init: rx ba win: 16 I (1321) wifi_init: tcpip mbox: 32 I (1321) wifi_init: udp mbox: 6 I (1321) wifi_init: tcp mbox: 6 I (1321) wifi_init: tcp tx win: 5760 I (1322) wifi_init: tcp rx win: 5760 I (1322) wifi_init: tcp mss: 1440 I (1322) wifi_init: WiFi/LWIP prefer SPIRAM W (1442) DH: NFC not enabled D (1450) CACT: check action init Double buffer 19200 I (1468) spi_bus: SPI2 bus created I (1469) spi_bus: SPI2 bus device added, CS=10 Mode=0 Speed=60000000 I (1520) lcd st7789: MADCTL=a0 I (1520) bsp_lcd: Screen name : [ST7789] | width : [320] | height : [240] I (1577) gpio: GPIO[41]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:3 I (1577) gpio: GPIO[40]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:3 D (1578) BTN: pin ENTER 39 active 0 D (1592) BTN: pin BACK 0 active 0 LCD backlight use PWM 4 D (1629) NET: networks start D (1631) DEV_OTA: device ota started I (1633) DIAG: diag init D (1638) NET: wifi setup by user D (1640) NET: trying wifi D (1641) NETW: connect wifi now I (1641) phy_init: phy_version 640,cd64a1a,Jan 24 2024,17:28:12 I (1673) wifi:mode : sta (dc:da:0c:1e:21:c4) I (1673) wifi:enable tsf I (1674) MOD_DIAG: core 0 event: WIFI_EVENT id=40 I (1674) wifi: STA_START I (1674) MOD_DIAG: core 0 event: WIFI_EVENT id=2 -------- [2, 2, bytearray(b'')] -------- [2, 2, bytearray(b'')] I (1690) NETW: connect to ssid[LC-IOT] pwd[**] D (1693) NETW: #0 connecting WiFi LCD duty= 511 I (1723) wifi:new:<1,0>, old:<1,0>, ap:<255,255>, sta:<1,0>, prof:1 D (1744) APP_MGR: custom apps found: ['photo_album', 'work_calendar'] I (2117) wifi:state: init -> auth (b0) I (2122) wifi:state: auth -> assoc (0) I (2135) wifi:state: assoc -> run (10) I (2170) wifi:connected with LC-IOT, aid = 14, channel 1, BW20, bssid = e6:b3:70:f2:bf:f6 I (2170) wifi:security: WPA2-PSK, phy: bgn, rssi: -87 I (2171) wifi:pm start, type: 1

I (2171) wifi:dp: 1, bi: 102400, li: 3, scale listen interval from 307200 us to 307200 us I (2172) wifi:set rx beacon pti, rx_bcn_pti: 14, bcn_timeout: 25000, mt_pti: 14, mt_time: 10000 I (2172) network: CONNECTED I (2173) MOD_DIAG: core 0 event: WIFI_EVENT id=4 -------- [2, 4, bytearray(b'LC-IOT\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x06\xe6\xb3p\xf2\xbf\xf6\x01\x03\x00\x00\x00\x00\x00\x00\x00')] I (2218) wifi:dp: 2, bi: 102400, li: 4, scale listen interval from 307200 us to 409600 us I (2218) wifi:AP's beacon interval = 102400 us, DTIM period = 2 I (2229) wifi:idx:0 (ifx:0, e6:b3:70:f2:bf:f6), tid:0, ssn:0, winSize:64 I (3674) network: GOT_IP I (3674) MOD_DIAG: core 0 event: IP_EVENT id=0 I (3675) esp_netif_handlers: sta ip: 10.20.30.94, mask: 255.255.255.0, gw: 10.20.30.1 -------- [1, 0, bytearray(b' r\xcb?\n\x14\x1e^\xff\xff\xff\x00\n\x14\x1e\x01\x01\x00\x00\x00')] D (3737) APP_MGR: user app: <module 'apps.work_calendar' from 'apps/work_calendar/init.py'> work_calendar ['class', 'name', 'dict', 'file', 'path', 'json', 'time', 'asyncio', 'utils', 'app', 'settings', 'on_start', 'on_stop', 'requests', 'net', 'lv', 'NAME', 'app_mgr', 'format_date', 'clocktime', 'on_boot', 'get_settings_json', 'parse_datetime', 'format_time', 'format_time_tz', 'AppSettings', 'api_client', 'APIClient', 'ui_renderer', 'UIRenderer', 'inspect_object', 'CONTAINER_WIDTH', 'CONTAINER_HEIGHT', 'PADDING', 'LABEL_WIDTH', 'DEVICE_CODE_TIMEOUT', 'request_new_tokens', 'refresh_or_request_new_tokens', 'query_events'] apps.work_calendar D (3868) APP_MGR: user app: <module 'apps.photo_album' from 'apps/photo_album/init.py'> photo_album ['class', 'name', 'dict', 'file', 'path', 'on_start', 'on_stop', 'lv', 'scr', 'event_handler', 'NAME', 'ICON', 'PHOTO_PATHS', 'PHOTO_COUNT', 'DEFAULT_BG_COLOR', 'photo_index', 'load_photo', 'change_photo'] apps.photo_album I (3873) APP_MGR: Pomodoro[0]: on_boot I (3876) APP_MGR: Calendar[0]: on_boot I (3878) APP_MGR: Weather[0]: on_boot I (3881) APP_MGR: Stock[0]: on_boot I (3883) APP_MGR: Cryptocurrency[0]: on_boot I (3885) APP_MGR: PC H/W Monitoring[0]: on_boot I (3888) APP_MGR: Settings[0]: on_boot I (3890) APP_MGR: Now Playing[0]: on_boot I (3893) APP_MGR: Screen Mirroring[0]: on_boot I (3895) APP_MGR: Game Emulator[0]: on_boot I (3898) APP_MGR: Work Calendar[0]: on_boot I (3901) APP_MGR: Photo Album[0]: on_boot I (3911) NETW: wifi ok! config: ('10.20.30.94', '255.255.255.0', '10.20.30.1', '10.20.30.1') D (3918) NET: ip changed [UNKNOWN] -> [10.20.30.94] I (3927) CACT: already get time, exit sync time task D (3931) CACT: first check action in 1s (FAST) D (3933) DEV_MON: add task monitor [taskCheckAction] D (3992) DEV_MON: add task monitor [checkConnectLoop] D (3998) BLINKM: led refresh None@APPLICATION W (3999) NET: net ok D (4001) BLINKM: led refresh NORMAL@DEFAULT D (4010) NTP: sync time from: pool.ntp.org I (4033) wifi:idx:1 (ifx:0, e6:b3:70:f2:bf:f6), tid:6, ssn:2, winSize:64 I (10112) wifi:state: run -> init (22c0) I (10112) wifi:pm stop, total sleep time: 3299972 us / 7941346 us

I (10113) wifi:idx:0, tid:0 I (10113) wifi:idx:1, tid:6 I (10113) wifi:new:<1,0>, old:<1,0>, ap:<255,255>, sta:<1,0>, prof:1 I (10114) wifi: STA_DISCONNECTED, reason:34 I (10115) MOD_DIAG: core 0 event: WIFI_EVENT id=5 I (10123) wifi:new:<1,0>, old:<1,0>, ap:<255,255>, sta:<1,0>, prof:1 I (10123) wifi:state: init -> auth (b0) I (10129) wifi:state: auth -> assoc (0) I (10147) wifi:state: assoc -> run (10) I (10184) wifi:connected with LC-IOT, aid = 14, channel 1, BW20, bssid = e6:b3:70:f2:bf:f6 I (10184) wifi:security: WPA2-PSK, phy: bgn, rssi: -89 I (10185) wifi:pm start, type: 1

I (10185) wifi:dp: 1, bi: 102400, li: 3, scale listen interval from 307200 us to 307200 us I (10185) wifi:set rx beacon pti, rx_bcn_pti: 14, bcn_timeout: 25000, mt_pti: 14, mt_time: 10000 I (10186) network: CONNECTED I (10186) MOD_DIAG: core 0 event: WIFI_EVENT id=4 I (10205) wifi:dp: 2, bi: 102400, li: 4, scale listen interval from 307200 us to 409600 us I (10205) wifi:AP's beacon interval = 102400 us, DTIM period = 2 I (10212) wifi:idx:0 (ifx:0, e6:b3:70:f2:bf:f6), tid:0, ssn:0, winSize:64 -------- [2, 4, bytearray(b'LC-IOT\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x06\xe6\xb3p\xf2\xbf\xf6\x01\x03\x00\x00\x00\x00\x00\x00\x00')] -------- [2, 4, bytearray(b'LC-IOT\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x06\xe6\xb3p\xf2\xbf\xf6\x01\x03\x00\x00\x00\x00\x00\x00\x00')] E (11026) NTP: unable to get NTP time Traceback (most recent call last): File "core/nwk/ntp.py", line 53, in _ntp OSError: -202 D (11027) NTP: wait 3s D (11037) CACT: sending PING request D (11050) API: HEARTBEAT: https://dock-sync.myvobot.com/ping?seq=0&app=256&f=0&hw=256&idle=0&sys=65540&type=13&tz=0&up=11&bat=-10&id=DCDA0C1E21C4 I (11126) REQS: connecting to https://dock-sync.myvobot.com:443/ping?seq=0&app=256&f=0&hw=256&idle=0&sys=65540&type=13&tz=0&up=11&bat=-10&id=DCDA0C1E21C4 ~D (11142) BLINKM: led refresh NET_FAIL@APPLICATION W (11143) NET: net fail D (11143) NET: connection lost 1 _E (11176) REQS: OSError -202 Traceback (most recent call last): File "arequests.py", line 170, in request File "asyncio/funcs.py", line 1, in wait_for File "asyncio/funcs.py", line 1, in _run File "asyncio/core.py", line 1, in run_until_complete File "asyncio/stream.py", line 1, in open_connection OSError: -202 E (11179) REQS: https://dock-sync.myvobot.com/ping?seq=0&app=256&f=0&hw=256&idle=0&sys=65540&type=13&tz=0&up=11&bat=-10&id=DCDA0C1E21C4 request failed. E (11181) API: GET request fail (1/1) Traceback (most recent call last): File "core/iot/http_api_request.py", line 251, in doRequest File "arequests.py", line 288, in get File "arequests.py", line 179, in request ValueError: open connection OSError D (11184) API: failed for 1 W (11185) CACT: first check action fail, retry ping in 5s (START) D (14033) NTP: sync time from: time.windows.com E (14036) NTP: unable to get NTP time Traceback (most recent call last): File "core/nwk/ntp.py", line 53, in _ntp OSError: -202 D (14038) NTP: wait 6s I (15687) network: GOT_IP I (15688) MOD_DIAG: core 0 event: IP_EVENT id=0 I (15688) esp_netif_handlers: sta ip: 10.20.30.94, mask: 255.255.255.0, gw: 10.20.30.1 -------- [1, 0, bytearray(b' r\xcb?\n\x14\x1e^\xff\xff\xff\x00\n\x14\x1e\x01\x00\x00\x00\x00')] I (15862): enter web portal 2 D (15864) NET: wifi setup by user I (16317) APP_MGR: Start: HOME I (16328) APP_MGR: Stop: HOME I (16331) APP_MGR: Work Calendar[0]: on_create I (16461) wifi:idx:1 (ifx:0, e6:b3:70:f2:bf:f6), tid:6, ssn:2, winSize:64 E (23455) APP_MGR: app failed Traceback (most recent call last): File "variants/dock_hub/ui/apps/init.py", line 286, in _app_access File "apps/work_calendar/init.py", line 59, in on_start File "apps/work_calendar/init.py", line 95, in query_events File "apps/work_calendar/api_client.py", line 111, in query_events File "urequests.py", line 180, in get File "urequests.py", line 76, in request OSError: -202 I (23459) APP_MGR: Work Calendar[1]: on_start I (23462) APP_MGR: Work Calendar[2]: on_resume D (23483) UI: ui loaded I (23526) wifi:state: run -> init (22c0) I (23526) wifi:pm stop, total sleep time: 4200706 us / 13341579 us

I (23527) wifi:idx:0, tid:0 I (23527) wifi:idx:1, tid:6 I (23527) wifi:new:<1,0>, old:<1,0>, ap:<255,255>, sta:<1,0>, prof:1 I (23528) wifi: STA_DISCONNECTED, reason:34 I (23529) MOD_DIAG: core 0 event: WIFI_EVENT id=5 -------- [2, 5, bytearray(b'LC-IOT\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x06\xe6\xb3p\xf2\xbf\xf6"\xa9')] D (23560) SCHEDULED: schedule mode close. ~D (23659) NET: connection lost 2 D (23666): system busy begin _D (23744) NTP: sync time from: ntp1.hetzner.de I (24742) wifi:new:<11,0>, old:<1,0>, ap:<255,255>, sta:<11,0>, prof:1 I (24743) wifi:state: init -> auth (b0) I (24743) MOD_DIAG: core 0 event: WIFI_EVENT id=40 I (24746) wifi:state: auth -> assoc (0) I (24754) wifi:state: assoc -> run (10) I (24772) wifi:connected with LC-IOT, aid = 5, channel 11, BW20, bssid = e2:b3:70:f2:bb:02 I (24772) wifi:security: WPA2-PSK, phy: bgn, rssi: -57 I (24773) wifi:pm start, type: 1

I (24773) wifi:dp: 1, bi: 102400, li: 3, scale listen interval from 307200 us to 307200 us I (24773) wifi:set rx beacon pti, rx_bcn_pti: 14, bcn_timeout: 25000, mt_pti: 14, mt_time: 10000 I (24774) network: CONNECTED I (24774) MOD_DIAG: core 0 event: WIFI_EVENT id=4 I (24783) wifi:idx:0 (ifx:0, e2:b3:70:f2:bb:02), tid:0, ssn:0, winSize:64 I (24825) wifi:dp: 2, bi: 102400, li: 4, scale listen interval from 307200 us to 409600 us I (24825) wifi:AP's beacon interval = 102400 us, DTIM period = 2 I (25775) network: GOT_IP I (25776) MOD_DIAG: core 0 event: IP_EVENT id=0 I (25776) esp_netifhandlers: sta ip: 10.20.30.94, mask: 255.255.255.0, gw: 10.20.30.1 I (27750) wifi:idx:1 (ifx:0, e2:b3:70:f2:bb:02), tid:6, ssn:2, winSize:64 -------- [1, 0, bytearray(b' r\xcb?\n\x14\x1e^\xff\xff\xff\x00\n\x14\x1e\x01\x00\x00\x00\x00')] -------- [1, 0, bytearray(b' r\xcb?\n\x14\x1e^\xff\xff\xff\x00\n\x14\x1e\x01\x00\x00\x00\x00')] -------- [1, 0, bytearray(b' r\xcb?\n\x14\x1e^\xff\xff\xff\x00\n\x14\x1e\x01\x00\x00\x00\x00')] D (27871) NTP: get time from NTP: 1721977438 I (28091) CFGMGR: cfg saved ok D (28093) NTP: sys time now: 1721977438 D (28095): system busy end D (28647): url=https://apiproxy.myvobot.com/weather?lat=51.33261&lon=-0.2678212 I (28724) REQS: connecting to https://apiproxy.myvobot.com:443/weather?lat=51.33261&lon=-0.2678212 D (28726): system busy begin ~D (28845) BLINKM: led refresh None@APPLICATION W (28846) NET: net ok D (28847) BLINKM: led refresh NORMAL@DEFAULT I (29608) esp-x509-crt-bundle: Certificate validated D (29965): system busy end D (29968) REQS: sending... (apiproxy.myvobot.com) D (29988) REQS: reading... (apiproxy.myvobot.com) D (30734) REQS: header received (apiproxy.myvobot.com) D (30736) REQS: receiving: 516 bytes D (30749) API: GET status code: 200 I (30811) CFGMGR: cfg saved ok D (32836) CACT: sending PING request D (32848) API: HEARTBEAT: https://dock-sync.myvobot.com/ping?seq=1&app=256&f=0&hw=256&idle=0&sys=65540&type=13&tz=0&up=32&bat=-10&id=DCDA0C1E21C4 I (32957) REQS: connecting to https://dock-sync.myvobot.com:443/ping?seq=1&app=256&f=0&hw=256&idle=0&sys=65540&type=13&tz=0&up=32&bat=-10&id=DCDA0C1E21C4 D (32959): system busy begin I (33509) esp-x509-crt-bundle: Certificate validated ~D (34056): system busy end D (34059) REQS: sending... (dock-sync.myvobot.com) D (34136) REQS: reading... (dock-sync.myvobot.com) D (34947) REQS: header received (dock-sync.myvobot.com) D (34950) REQS: receiving unknown length D (35051) API: GET status code: 200 I (35054) CACT: action=none D (35056) CACT: check action ok, retry ping in 600s (SLOW)

In my app is there a way to detect when the network is up and running so that it can start properly (invoking on_start)? I saw there is a net.connected() but it returns just a boolean and not an async. Do I need to create a loop and check for a truthy return value ? It's a bit an overkill isn't it? Any alternatives?

pumpkin-zbh commented 4 months ago

After reviewing the logs, we found that your device encountered an error (Error code WIFI_REASON_MISSING_ACKS) after completing the WiFi connection during the boot phase. This led to the WiFi disconnection and subsequently caused the NTP time synchronization to fail. However, after retrying, the connection was restored, and the NTP time was successfully synchronized.

The WIFI_REASON_MISSING_ACKS error indicates that the device failed to receive the expected acknowledgment (ACK) frames, resulting in a communication interruption. This could be related to your network environment.

Regarding your concern about detecting when the network is up and running, you do not need to check the network status in the on_start function. The on_start function should only handle the initialization of your program. You can check the network status in the on_running_foreground() function by calling net.connected(). Please note that once the application becomes active, the system will call on_running_foreground() approximately every 200 milliseconds, allowing you to periodically check the network connection status.

lcervo commented 4 months ago

ok! I implemented that the logic in the on_running_foreground(). I have another question. I have a button added to the screen and I attached an event to it. How can I trigger that event using the click of the rotary button?

pumpkin-zbh commented 4 months ago

Once you add an event to the component and focus on it following this example, the button event registration will be complete:

scr.add_event(event_handler, lv.EVENT.ALL, None)
lv.group_get_default().add_obj(scr)
lv.group_focus_obj(scr)

When you press the button, the event will be triggered and the event_handler function will be executed. You can write the event_handler function as shown in the example below:

def event_handler(e):
    code = e.get_code()
    if code == lv.EVENT.CLICKED:
        # Event triggered when the encoder button is pressed. 
        # You can write the logic for the encoder button press here.
    elif code == lv.EVENT.KEY and e.get_key() == lv.KEY.ESC:
        # Event triggered when the ESC key is pressed. 
        # You can write the logic for the ESC key press here.

By following this approach, you can trigger the event using the click of the rotary button.

lcervo commented 4 months ago

that was it!! thank you!!!