Files
MeshCore/variants/m5stack_cardputer_adv/globals.h
T
mjgodatandClaude Opus 5.5 5681898ad4 Add M5Stack Cardputer-Adv variant with keyboard/display companion UI
New variant variants/m5stack_cardputer_adv for the Cardputer-Adv
(ESP32-S3, 8 MB) with the Cap LoRa-1262 (SX1262 + GNSS):

- Envs: companion_radio_ble, companion_radio_usb, repeater, room_server.
- Board: enables the Cap's antenna path via the PI4IOE5V6408 on the
  internal I2C bus (Wire1, G8/G9); Wire stays on the Grove port. LoRa and
  microSD share FSPI because the display owns SPI3. TCXO 1.8 V.
- Companion UI adapted from MultiMote/meshcore-cardputer-adv (MIT,
  LICENSE.MultiMote), running on the standard companion so the USB
  terminal CLI stays available. Contacts/identity stay in internal
  SPIFFS; the microSD card is optional (chat history, keyboard layouts).
- Sticky Shift, one-shot Fn with Fn+letter shortcuts, top button (G0)
  sends a flood advert, brightness control.
- Text size setting (Normal/Large/Extra large) with DejaVu Sans fonts
  generated by tools/gen_vlw_font.py; layouts derive from the font size.
- Power save maps to the companion's powersaving pref; the UI vetoes
  light sleep while the screen is on. Low-battery power-off at 3.4 V.
- win_long_cmdline.py: Windows-only -iprefix include shortening so the
  ESP32 compile command stays under the 32,767-character limit.

Shared companion changes are guarded by CARDPUTER_ADV_UI: main.cpp
selects CardputerDataStore/CardputerUITask/CardputerMesh, and MyMesh.h
maps the_mesh to the subclass like the PSRAM storage path does.

Tested on hardware (910.525 MHz mesh): radio RX/TX, USB CLI, BLE, UI.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-27 16:24:43 -07:00

74 lines
3.0 KiB
C

#pragma once
#define CUSTOM_DATA_DIR "/meshcore_custom"
#define CUSTOM_PREFS_FILE CUSTOM_DATA_DIR "/prefs"
#define HISTORY_DIR CUSTOM_DATA_DIR "/history"
#define HISTORY_DIR_CHANNEL HISTORY_DIR "/chan"
#define HISTORY_DIR_DIRECT HISTORY_DIR "/direct"
#define KB_LAYOUT_MAIN_FILE CUSTOM_DATA_DIR "/keyboard_main.txt"
#define KB_LAYOUT_ALT_FILE CUSTOM_DATA_DIR "/keyboard_alt.txt"
/** Max utf-8 character length for keyboard key */
#define KB_LAYOUT_CHAR_MAX 3
#define MAX_MESSAGE_LENGTH 150
#define BATT_MIN_MILLIVOLTS 3350 // From M5Unified
#define BATT_MAX_MILLIVOLTS 4150 // From M5Unified
#define UI_RECENT_LIST_SIZE 8
#define UI_CHANNEL_SEARCH_MAX_CHARS 32
#define AUTO_OFF_MILLIS 15000 // 15 seconds
#define MAX_UNREAD_MSGS 32
#define BOOT_SCREEN_MILLIS 2000
#define NEW_MESSAGE_DISPLAY_MILLIS AUTO_OFF_MILLIS
#define CHAT_HISTORY_RINGBUF_SIZE 15
#define UNREAD_COUNTER_MAX_ITEMS 32
#define MAX_DISCOVERED_REPEATERS 8
#define CONTACT_LOOKUP_BYTES 6
#define DIRECT_SEND_ROUTE_ATTEMPTS 3
#define DIRECT_SEND_ROUTE_RESEND_RELAY 8000
#define DIRECT_SEND_FLOOD_ATTEMPTS 3
#define DIRECT_SEND_FLOOD_RESEND_RELAY 10000
// ================== PINS ==================
// Cap LoRa-1262 IO expander, audio codec (ES8311), keyboard (TCA8418)
#define PIN_I2C_INTERNAL_SDA 8
#define PIN_I2C_INTERNAL_SCL 9
// Cap LoRa-1262 IO expander
#define LORA_IOE_I2C_ADDRESS 0x43
// LCD (ST7789V2)
#define TFT_SPI_HOST SPI3_HOST
#define PIN_TFT_SCK 36
#define PIN_TFT_MOSI 35
#define PIN_TFT_RST 33
#define PIN_TFT_DC 34
#define PIN_TFT_CS 37
#define PIN_TFT_BL 38
// Audio codec (ES8311)
#define AUDIO_I2C_ADDRESS 0x18
#define PIN_AUDIO_SCLK 41
#define PIN_AUDIO_ASDOUT 46
#define PIN_AUDIO_LRCK 43
#define PIN_AUDIO_DSDIN 42
#define AUDIO_SAMPLE_RATE 16000
#define AUDIO_MAX_SAFE_VOLUME 20000.0f
#define AUDIO_BUFFER_SIZE 256
/** Time to wait from codec init to first sound played */
#define AUDIO_WARMUP_MS 1100
// Top button (BtnG0, active low); sends an advert in the companion UI
#define PIN_TOP_BUTTON 0
// Keyboard (TCA8418)
#define KEYBOARD_I2C_ADDRESS 0x34
#define PIN_KEYBOARD_INT 11