Commit Graph
70 Commits
Author SHA1 Message Date
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
jpirnay 442b666826 feat: battery charging indicator (mirroring PR #537) (#1427)
## Summary

* **What is the goal of this PR?** All praise goes to @didacta for his
PR #537. Just picked up the reviewer comments to contain the changes as
suggested (there was no response for more than 6 weeks, so I wanted to
reanimate this feature).

Just one addition: should recognize usb cable plug ins / retractions and
update the icon immediately

* **What changes are included?**

## Additional Context

see #537 

---

### 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 >**_
2026-03-19 22:33:29 -05:00
jpirnay b44a47b9de Fix 2026-03-19 11:26:28 +01:00
jpirnay 477f3aa886 Merge branch 'feat-sdcard-info' of https://github.com/jpirnay/crosspoint-reader into mybuild 2026-03-19 11:20:47 +01:00
jpirnay 12bf78592f Reuse SDCArdManager logic 2026-03-19 11:12:48 +01:00
jpirnay 2efef0c519 Merge branch 'feat-charger' of https://github.com/jpirnay/crosspoint-reader into mybuild 2026-03-18 13:27:02 +01:00
jpirnay ce6676d211 Add immediate response for usb cable plug in / removal 2026-03-18 12:56:35 +01:00
jpirnay 0a8a644773 Merge branch 'feat-charger' of https://github.com/jpirnay/crosspoint-reader into mybuild 2026-03-18 12:26:24 +01:00
jpirnay a7494c232c Mirroring PR #537 2026-03-18 12:24:44 +01:00
jpirnay 7df68fcf31 Merge branch 'feat-sdcard-info' of https://github.com/jpirnay/crosspoint-reader into mybuild 2026-03-17 21:27:10 +01:00
jpirnay 65e100d196 review 2026-03-16 23:44:25 +01:00
jpirnay fd685a5e14 Expose freebytes too 2026-03-16 21:28:06 +01:00
jpirnay eb4a0e3a7c Review comments 2026-03-16 21:25:27 +01:00
jpirnay 3e7a8bf8ff Relocate logic 2026-03-16 20:33:58 +01:00