[PR #363] [CLOSED] Preprocess *.json files to support conditional "compile" and comments. #1056

Closed
opened 2026-03-20 18:15:04 +01:00 by sascha_hemi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/OpenEPaperLink/OpenEPaperLink/pull/363
Author: @skiphansen
Created: 8/28/2024
Status: Closed

Base: masterHead: oepl_pr_14


📝 Commits (3)

  • 2889c37 Preprocess *.json files to support conditional "compile" and comments.
  • 33db596 Remove local content from content_cards.json.
  • 6602e36 Fix Current date and RSS feed ifdefs.

📊 Changes

5 files changed (+89 additions, -15 deletions)

View changed files

📝 ESP32_AP-Flasher/.gitignore (+1 -0)
📝 ESP32_AP-Flasher/platformio.ini (+37 -2)
ESP32_AP-Flasher/preprocess_json.py (+32 -0)
📝 ESP32_AP-Flasher/src/content_cards.json (+19 -0)
📝 ESP32_AP-Flasher/src/contentmanager.cpp (+0 -13)

📄 Description

I'm using these changes locally and I would like the team's feedback if they should be merged into the main repo or not.

Goals:

  1. Add support for comments and #ifdefs in select .json files.
  2. Make it easier to include/exclude content generation via platform.ini defines.

Background:
I've developed some content such as tide level charts which are of limited interest. I'd like to make that content available as a compile time option, but I don't want to "spam" the content_cards.json file.

One thing I've found frustrating about .json files for years is the lack of support for comments. I find adding comments to entries like

"gridparam": [ 5, 17, 20, "calibrib16.vlw", "tahoma9.vlw", 14 ]

helpful to avoid needing to find the corresponding code to figure out what the the numbers mean.

Summary of changes:

  1. Move select .json files from current locations to new location (currently just content_cards.json).
  2. Move #define CONTENT* defines from contentmanager.cpp to platform.ini
  3. Add a platformIO extra_script to use the C preprocessor to create the runtime .json file from the source .json file based on the CONTENT* defines from the platform.ini file.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/OpenEPaperLink/OpenEPaperLink/pull/363 **Author:** [@skiphansen](https://github.com/skiphansen) **Created:** 8/28/2024 **Status:** ❌ Closed **Base:** `master` ← **Head:** `oepl_pr_14` --- ### 📝 Commits (3) - [`2889c37`](https://github.com/OpenEPaperLink/OpenEPaperLink/commit/2889c37d6542e4c474d35db8054b0ebd20d22528) Preprocess *.json files to support conditional "compile" and comments. - [`33db596`](https://github.com/OpenEPaperLink/OpenEPaperLink/commit/33db5964b2f057a7cc98896f07dc2e2f9db076e5) Remove local content from content_cards.json. - [`6602e36`](https://github.com/OpenEPaperLink/OpenEPaperLink/commit/6602e361cd848f4399ea68040dd9787b8b7f844b) Fix Current date and RSS feed ifdefs. ### 📊 Changes **5 files changed** (+89 additions, -15 deletions) <details> <summary>View changed files</summary> 📝 `ESP32_AP-Flasher/.gitignore` (+1 -0) 📝 `ESP32_AP-Flasher/platformio.ini` (+37 -2) ➕ `ESP32_AP-Flasher/preprocess_json.py` (+32 -0) 📝 `ESP32_AP-Flasher/src/content_cards.json` (+19 -0) 📝 `ESP32_AP-Flasher/src/contentmanager.cpp` (+0 -13) </details> ### 📄 Description I'm using these changes locally and I would like the team's feedback if they should be merged into the main repo or not. Goals: 1. Add support for comments and #ifdefs in select .json files. 2. Make it easier to include/exclude content generation via platform.ini defines. Background: I've developed some content such as tide level charts which are of limited interest. I'd like to make that content available as a compile time option, but I don't want to "spam" the content_cards.json file. One thing I've found frustrating about .json files for years is the lack of support for comments. I find adding comments to entries like ```"gridparam": [ 5, 17, 20, "calibrib16.vlw", "tahoma9.vlw", 14 ]``` helpful to avoid needing to find the corresponding code to figure out what the the numbers mean. Summary of changes: 1. Move select .json files from current locations to new location (currently just content_cards.json). 2. Move #define CONTENT* defines from contentmanager.cpp to platform.ini 3. Add a platformIO extra_script to use the C preprocessor to create the runtime .json file from the source .json file based on the CONTENT* defines from the platform.ini file. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
sascha_hemi added the pull-request label 2026-03-20 18:15:04 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/OpenEPaperLink#1056