Commit Graph
20 Commits
Author SHA1 Message Date
jpirnay 87b5776648 Wire clock to fil date times 2026-04-20 09:07:56 +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 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 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 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
jpirnay 87bbfb26af Display available space on SDCard 2026-03-16 20:26:36 +01:00
jpirnay 69f893840a Add getmODIFYdATEtIME 2026-03-08 10:08:38 +01:00
Xuan-Son NguyenandZach Nelson a2a242b8c2 fix: make file system operations thread-safe (HalFile) (#1212)
## Summary

Fix https://github.com/crosspoint-reader/crosspoint-reader/issues/1137

Introducing `HalFile`, a thin wrapper around `FsFile` that uses a global
mutex to protect file operations.

To test this PR, place the code below somewhere in the code base (I
placed it in `onGoToRecentBooks`)

```cpp
static auto testTask = [](void* param) {
  for (int i = 0; i < 10; i++) {
    String json = Storage.readFile("/.crosspoint/settings.json");
    LOG_DBG("TEST_TASK", "Read settings.json, bytes read: %u", json.length());
  }
  vTaskDelete(nullptr);
};
xTaskCreate(testTask, "test0", 8192, nullptr, 1, nullptr);
xTaskCreate(testTask, "test1", 8192, nullptr, 1, nullptr);
xTaskCreate(testTask, "test2", 8192, nullptr, 1, nullptr);
xTaskCreate(testTask, "test3", 8192, nullptr, 1, nullptr);
delay(1000);
```

It will reliably lead to crash on `master`, but will function correctly
with this PR.

A macro renaming trick is used to avoid changing too many downstream
code files.

---

### 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? **PARTIALLY**, only to
help with tedious copy-paste tasks

---------

Co-authored-by: Zach Nelson <zach@zdnelson.com>
2026-02-28 11:15:27 +01:00
jpirnayandDave Allie cd748a01a9 feat: Migrate binary settings to json (#920)
## Summary

* This PR introduces a migration from binary file storage to JSON-based
storage for application settings, state, and various credential stores.
This improves readability, maintainability, and allows for easier manual
configuration editing.
* Benefits:
  - Settings files are now JSON and can be easily read/edited manually
  - Easier to inspect application state and settings during development
  - JSON structure is more flexible for future changes
* Drawback: around 15k of additional flash usage
* Compatibility: Seamless migration preserves existing user data

## Additional Context
1. New JSON I/O Infrastructure files:
- JsonSettingsIO: Core JSON serialization/deserialization logic using
ArduinoJson library
- ObfuscationUtils: XOR-based password obfuscation for sensitive data
2. Migrated Components (now use JSON storage with automatic binary
migration):
     - CrossPointSettings (settings.json): Main application settings
- CrossPointState (state.json): Application state (open book, sleep
mode, etc.)
- WifiCredentialStore (wifi.json): WiFi network credentials (Password
Obfuscation: Sensitive data like WiFi passwords, uses XOR encryption
with fixed keys. Note: This is obfuscation, not cryptographic security -
passwords can be recovered with the key)
- KOReaderCredentialStore (koreader.json): KOReader sync credentials
     - RecentBooksStore (recent.json): Recently opened books list
3. Migration Logic
     - Forward Compatibility: New installations use JSON format
- Backward Compatibility: Existing binary files are automatically
migrated to JSON on first load
- Backup Safety: Original binary files are renamed with .bak extension
after successful migration
- Fallback Handling: If JSON parsing fails, system falls back to binary
loading
4. Infrastructure Updates
     - HalStorage: Added rename() method for backup operations

---

### 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? _** YES**_

---------

Co-authored-by: Dave Allie <dave@daveallie.com>
2026-02-22 17:18:25 +11:00
Xuan-Son Nguyen e7665b6086 feat: add HalStorage (#656)
## Summary

Continue my changes to introduce the HAL infrastructure from
https://github.com/crosspoint-reader/crosspoint-reader/pull/522

This PR touches quite a lot of files, but most of them are just name
changing. It should not have any impacts to the end behavior.

## Additional Context

My plan is to firstly add this small shim layer, which sounds useless at
first, but then I'll implement an emulated driver which can be helpful
for testing and for development.

Currently, on my fork, I'm using a FS driver that allow "mounting" a
local directory from my computer to the device, much like the `-v` mount
option on docker. This allows me to quickly reset `.crosspoint`
directory if anything goes wrong. I plan to upstream this feature when
this PR get merged.

---

### 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-02-09 07:29:14 +11:00