## Summary Two M1 firmware enhancements on the Waveshare ESP32-S3-RLCD-4.2: **Local-time display (UTC+8, fixed offset — China has no DST).** Internal time stays strictly UTC (RTC chip, JSONL `utc`, console `--json` keep the `Z`-suffixed machine format). Only human-facing surfaces convert via the new `board::kLocalUtcOffsetSeconds`: - display RTC line renders `unix + 8*3600` labeled `UTC+8` (split after the date: measured montserrat16 widths 157px + 119px fit the 179px status column; the old one-line layout was already 223px and overflowed) - text `status` and `rtc status` show the labeled UTC+8 line and keep both the raw unix and a UTC line - `rtc set` now takes UTC+8 local time (validates the local calendar round-trip, converts -8h before `set_rtc_time`); help/usage/README updated **Three buttons.** - KEY (GPIO18) unchanged (short <1s / long 1-3s / >=3s portal). - BOOT (GPIO0, strapping pin — input + pull-up, runtime read only): mirrors the KEY 30ms debounce and release bands (short <1s, long >=1s), new `boot_short_presses` / `boot_long_presses`, no portal binding. - RST is hardwired to chip reset, so it is tracked as a persistent boot counter: NVS namespace `frame`, key `rst_cnt`, incremented once per boot after `nvs_flash_init`, exposed as `reset_count`. - Surfaces: display `KEY:a/b BOOT:c/d` + `RST:e` lines, console text + `--json` (`boot_short`, `boot_long`, `reset_count`), JSONL `boot_short`/`boot_long` only — measured 594B worst observed line vs the 640B buffer (46B headroom, gate was >=40B); `reset_count` is static per boot so it is `--json`-only. ## On-device verification (34/34 deterministic asserts PASS + user assist) Evidence: `.omo/evidence/m1wp/tz-buttons-finish-m1-wifi-provisioning.log` - Build 0 warnings; clang-format 18.1.8 clean on whole `main/`. - `rtc status`/text status UTC+8 lines match host `date` +8h (<=3s skew); `rtc set` with a UTC+8 local time round-trips (`1788157541 = 14:25:41 local - 8h`). - JSONL `utc` unchanged UTC-with-Z, crc32c intact, max line 594B < 640. - KEY short press: +1 with BOOT unchanged (user-assisted). BOOT short: +2 (user-assisted). BOOT long: not physically exercised this session — code path is the device-proven KEY band logic (same constants); noted in `.omo/notepads` for the next bench session. - RST/reset_count: host RTS-pulse reboot 3->4 with boot banner; `--json` agrees. - Regressions: wifi auto-connect CONNECTED, tf_logging true, selftest `wifi_config: ok` + `bad ignored`, `prov status` three-state. Co-authored-by: ania-lain <[email protected]>
53 lines
2.1 KiB
C++
53 lines
2.1 KiB
C++
#pragma once
|
|
|
|
#include <cstddef>
|
|
#include <cstdint>
|
|
|
|
#include "driver/gpio.h"
|
|
#include "driver/i2c_types.h"
|
|
#include "driver/spi_master.h"
|
|
|
|
namespace frame::m1::board {
|
|
|
|
inline constexpr char kProduct[] = "Waveshare ESP32-S3-RLCD-4.2";
|
|
inline constexpr char kModule[] = "ESP32-S3-WROOM-1-N16R8";
|
|
inline constexpr char kFirmwareVersion[] = "0.1.0-dev.1";
|
|
inline constexpr char kIdfTag[] = "v6.0.2";
|
|
|
|
inline constexpr std::size_t kFlashBytes = 16U * 1024U * 1024U;
|
|
inline constexpr std::size_t kPsramBytes = 8U * 1024U * 1024U;
|
|
|
|
inline constexpr int kDisplayWidth = 400;
|
|
inline constexpr int kDisplayHeight = 300;
|
|
inline constexpr std::size_t kDisplayBufferBytes =
|
|
static_cast<std::size_t>(kDisplayWidth) * static_cast<std::size_t>(kDisplayHeight) / 8U;
|
|
inline constexpr spi_host_device_t kDisplayHost = SPI3_HOST;
|
|
inline constexpr int kDisplayClockHz = 10 * 1000 * 1000;
|
|
inline constexpr gpio_num_t kDisplaySck = GPIO_NUM_11;
|
|
inline constexpr gpio_num_t kDisplayMosi = GPIO_NUM_12;
|
|
inline constexpr gpio_num_t kDisplayDc = GPIO_NUM_5;
|
|
inline constexpr gpio_num_t kDisplayCs = GPIO_NUM_40;
|
|
inline constexpr gpio_num_t kDisplayReset = GPIO_NUM_41;
|
|
inline constexpr gpio_num_t kDisplayTe = GPIO_NUM_6;
|
|
|
|
inline constexpr i2c_port_num_t kI2cPort = I2C_NUM_0;
|
|
inline constexpr gpio_num_t kI2cSda = GPIO_NUM_13;
|
|
inline constexpr gpio_num_t kI2cScl = GPIO_NUM_14;
|
|
inline constexpr uint16_t kRtcAddress = 0x51;
|
|
inline constexpr uint16_t kSensorAddress = 0x70;
|
|
|
|
inline constexpr gpio_num_t kKey = GPIO_NUM_18;
|
|
// BOOT is a strapping pin; runtime config is input + pull-up read-only, never driven.
|
|
inline constexpr gpio_num_t kBoot = GPIO_NUM_0;
|
|
|
|
// Human-facing local time offset: China Standard Time (UTC+8), no daylight-saving transitions.
|
|
// Internal storage, JSONL, and machine `utc` fields stay strictly UTC.
|
|
inline constexpr int32_t kLocalUtcOffsetSeconds = 8 * 3600;
|
|
|
|
inline constexpr gpio_num_t kSdClock = GPIO_NUM_38;
|
|
inline constexpr gpio_num_t kSdCommand = GPIO_NUM_21;
|
|
inline constexpr gpio_num_t kSdData0 = GPIO_NUM_39;
|
|
inline constexpr char kSdMount[] = "/frame";
|
|
|
|
} // namespace frame::m1::board
|