Commit Graph
83 Commits
Author SHA1 Message Date
jpirnay 640abd9b99 Try more conditioning passes on x3 before sleepscreen to get rid of ghosting 2026-05-12 22:14:19 +02:00
jpirnay 4982f803a7 A couple of fixes 2026-05-11 23:02:27 +02:00
jpirnay 2b1dbb6737 Add extended TiltModel 2026-05-11 16:29:40 +02:00
jpirnay b8f2ecf23d Rework logic 2026-05-06 21:38:00 +02:00
jpirnay af87021290 A bit of hardening 2026-05-03 10:49:32 +02:00
jpirnay a6aed8d30e Add additional timezones 2026-04-20 20:40:38 +02:00
jpirnay 5b31d49036 One more safety net 2026-04-20 17:42:27 +02:00
jpirnay 9f95567212 Fix x3 boot issue 2026-04-20 17:33:46 +02:00
jpirnay 36931aaa25 Merge pull request #108 from jpirnay/feature-webui-update
feat: webui update (integrate some ideas from upstream #1715 by pablohc)
2026-04-20 14:05:43 +02:00
jpirnay bbafd4ce62 Display error reason on ntp time sync fail 2026-04-20 10:32:52 +02:00
jpirnay 8941ab9a1e Always provide datetime 2026-04-20 10:11:14 +02:00
jpirnay 87b5776648 Wire clock to fil date times 2026-04-20 09:07:56 +02:00
jpirnay f31159b430 Temperature sanity check 2026-04-17 23:32:26 +02:00
jpirnay 9492984850 Remove wire init 2026-04-17 23:27:38 +02:00
jpirnay 134527de5f Dont hammer the bus 2026-04-17 23:21:03 +02:00
jpirnay f68fbc39e4 Dont write guesstimates into RTC 2026-04-17 23:19:42 +02:00
jpirnay 141ec02746 Fix comments 2026-04-17 23:17:42 +02:00
jpirnay b6c3774de9 Proper timezone conversion 2026-04-17 23:14:40 +02:00
jpirnay 4d0af7331c X4 quick exit 2026-04-17 22:57:56 +02:00
jpirnay f7d970fe44 implement DS3231 clock support 2026-04-17 22:47:08 +02:00
jpirnay feda048dfa Fix missing X3 serial output 2026-04-17 16:20:40 +02:00
jpirnay 18b7e30f57 Incorporate and fix upstream PR 1635 2026-04-16 11:01:06 +02:00
jpirnay 25e9258d39 yaclf 2026-04-15 17:29:43 +02:00
jpirnay 201aef565b Remove page cache, proper 64 bit filesize and apply upstream 1648 2026-04-15 17:20:36 +02:00
jpirnay 4ff9a10de1 Amend back button handling, add "use as sleep screen" feature 2026-04-06 10:34:48 +02:00
jpirnay 4f00ed6348 Fast wakeup (not waiting for button release) 2026-04-06 10:07:50 +02:00
jpirnay 633cc04f41 Additional checks 2026-04-06 09:56:27 +02:00
jpirnay 213ebfc016 Second attempt at proper debouncing 2026-04-06 09:48:11 +02:00
jpirnay c86a5fee4c Deal with bouncing power key at startup 2026-04-05 21:06:58 +02:00
jpirnay 7e2291915f Merge branch 'x3-support'
# Conflicts:
#	lib/GfxRenderer/GfxRenderer.h
#	open-x4-sdk
2026-04-04 10:05:14 +02:00
Justin Mitchell 0db9d93f1c feat: add Xteink X3 hardware support
Adds HAL-level support for the Xteink X3 (SSD1677 controller, 792x528
display). Includes device detection, display initialization, button
mapping, power management, and theme adjustments for the X3 form factor.
2026-04-03 04:04:17 -04:00
jpirnayandClaude Sonnet 4.6 6c9f497d2b fix: release GPIO13 hold before re-entering deep sleep
gpio_hold_en(GPIO13) called in startDeepSleep() persists after wake when
keepClockAlive=true. A subsequent startDeepSleep() call (e.g. failed button
verification) would silently fail to change GPIO13's level, leaving the MOSFET
latched and trapping the device in a sleep/wake loop requiring a hardware reset.

Release the individual and global holds at the top of startDeepSleep() so each
sleep entry configures GPIO13 from a clean state. Also call
gpio_deep_sleep_hold_dis() immediately after wake in setup() as a defensive
measure.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-31 11:00:20 +02:00
jpirnay 4afce54c69 Merge branch 'feat-additional-compensation' of https://github.com/jpirnay/crosspoint-reader into mybuild
# Conflicts:
#	lib/hal/HalClock.cpp
#	src/CrossPointSettings.h
#	src/activities/reader/KOReaderSyncActivity.cpp
#	src/activities/settings/SettingsActivity.cpp
#	src/activities/settings/SettingsActivity.h
2026-03-30 09:17:29 +02:00
jpirnay 174bdf1f3d Fix correction direction 2026-03-30 09:10:04 +02:00
jpirnay 0bdfc6e816 Merge branch 'feat-additional-compensation' of https://github.com/jpirnay/crosspoint-reader into mybuild 2026-03-29 18:35:36 +02:00
jpirnay 4f92a9935e Adding experimental RTC temperature compensation 2026-03-29 18:19:35 +02:00
jpirnay 1b0c5fec28 Integration hell 2026-03-28 18:21:53 +01:00
jpirnay ab03fe3ab7 Merge branch 'feat-koysnc-xpath' of https://github.com/jpirnay/crosspoint-reader into mybuild 2026-03-28 16:23:11 +01:00
jpirnay 9d7aa4e5a8 Add method 2026-03-28 12:15:47 +01:00
jpirnay ba5b0b9191 Capitalize am / pm 2026-03-27 18:10:45 +01:00
jpirnay 316a1ac3ab Display drifitng stats 2026-03-27 11:49:13 +01:00
jpirnay 92877f9c36 Use ntp time sync at end of wifi activities 2026-03-26 21:55:28 +01:00
jpirnay 7f9456e8c6 Add calibration 2026-03-26 21:41:39 +01:00
jpirnay 1112a36806 Review comments 2026-03-26 20:31:41 +01:00
jpirnay 6e8254b815 Adding timezone support 2026-03-26 18:46:28 +01:00
jpirnay 166ce73e2d Addressing review comments 2026-03-26 17:34:00 +01:00
jpirnay 2bcfa50a7c yaclf 2026-03-26 17:03:30 +01:00
jpirnay dd9c9e6def Add basic clock support 2026-03-26 16:46:23 +01:00
jpirnay 4b71ae3a8c Merge branch 'master' of https://github.com/jpirnay/crosspoint-reader into mybuild 2026-03-22 13:18:02 +01:00
Xuan-Son NguyenandZach Nelson e1b74c9db5 fix: use sleep routine from the original firmware (#1298)
## Summary

Fixes #1263

I spent half of my day(-off) reverse engineering the stock english
firmware V3.1.1, it's more or less like solving a sudoku with some known
pieces (like debug strings, known static addresses, known compiled
function, etc) and then the task is to guess the rest.

Long story short, this is the sleep routine that they use:

<img width="674" height="604" alt="image"
src="https://github.com/user-attachments/assets/6d53ce44-7bae-40c7-b4fb-24f898dbcc05"
/>

From the code above:
- They pull down GPIO13 (value = 0xd) before sleep
- They verify that power button is released by doing a delay loop of
50ms, similar to what we're doing
- `esp_sleep_config_gpio_isolate` is called but I'm not 100% sure why
- Pull up power button, note that it's likely redundant because power
button should already pulled up by `InputManager`
- `param1` and `param2` means enabling front/side buttons for wake up,
but it doesn't used in the code in reality. But I think it's physically
impossible, see the explanation below
- `param3` means "wake up from power button"
- `esp_sleep_start` is used; there is a logic to handle if it fails to
sleep, then retry recursively (no idea why!)

My observation is that they use GPIO13 so that it will be on HIGH state
when the chip is powered on, without any user space code to keep it on
that state. And once going to deep sleep, it goes into FLOATING by
default. That may explain why it need to be in LOW state before going to
sleep. (Nice trick btw)

Looking again at the circuit diagram provided
[here](https://github.com/sunwoods/Xteink-X4/blob/main/readme-img/sch.jpg)
(note: it's not official):

<img width="705" height="384" alt="image"
src="https://github.com/user-attachments/assets/b98d59fd-47ca-4d3d-a24a-94bf999e957b"
/>

It kinda make sense as the GPIO13 and VBUS (USB VCC) have the same role,
they are part of a simple "battery protection" cirtuit

Now, we may wonder, how the device wake up when there is no battery at
all?

<img width="440" height="323" alt="image"
src="https://github.com/user-attachments/assets/2981c411-239b-49a7-b9f7-9a75b6c1b6d3"
/>

It seems like power button is not just a simple switch between GPIO3 and
ground, but it also linked the POWER_CTRL, which leads to nowhere on the
diagram, but I suppose it connects the battery back for a short amount
of time, just enough for the MCU to wake up, and GPIO13 goes HIGH again.
It may also explain why power button becomes non-responsive for ~1
second after power on, as it's being pulled up by the current from
battery (remind: high = not pressed, low = pressed)

To test the theory above, I simply **comment out** the
`esp_deep_sleep_enable_gpio_wakeup`:
- On battery, power button works as nothing happen
- On USB, it doesn't wake up, I need to press RST

---

Important things about my analysis:
1. I had to name every function on the code above **manually**, but I'm
99% confident about it. The only function that I'm not sure is
`esp_wifi_bt_power_domain_off` ; Edit: it was indeed mislabeled, see
https://github.com/crosspoint-reader/crosspoint-reader/pull/1298#discussion_r2879670852
2. Some logic inside the stock firmware looks very strange, there is
almost no mention to "arduino" in the hardware, suggesting that they may
just call esp-idf functions directly, bypassing the arduino abstraction.

---

### AI Usage

While CrossPoint doesn't have restrictions on AI tools in contributing,
please be transparent about their usage as it
helps set the right context for reviewers.

Did you use AI tools to help write this code? **NO**

---------

Co-authored-by: Zach Nelson <zach@zdnelson.com>
2026-03-21 13:35:38 -05:00