Some more improvements

This commit is contained in:
2026-03-01 08:26:07 +01:00
parent c6394650dc
commit d13c1ef8c1
10 changed files with 952 additions and 90 deletions

View File

@@ -53,7 +53,6 @@ static const ConfigDef configdefs[] = {
{"buzEnable", ConfigType::BOOL, false},
{"buzPower", ConfigType::BYTE, uint8_t(50)},
{"tempFormat", ConfigType::CHAR, 'C'},
{"switchBank", ConfigType::BYTE, uint8_t(0)},
{"key1", ConfigType::BYTE, uint8_t(1)},
{"key1long", ConfigType::BYTE, uint8_t(11)},
{"key2", ConfigType::BYTE, uint8_t(2)},
@@ -66,11 +65,14 @@ static const ConfigDef configdefs[] = {
{"key5long", ConfigType::BYTE, uint8_t(15)},
{"key6", ConfigType::BYTE, uint8_t(6)},
{"key6long", ConfigType::BYTE, uint8_t(16)},
{"n2kSysInst", ConfigType::BYTE, uint8_t(0)},
{"n2kDevInst", ConfigType::BYTE, uint8_t(0)},
{"n2kSysInst", ConfigType::BYTE, uint8_t(0)}, // 4 bits unsigned
{"n2kDevInst", ConfigType::BYTE, uint8_t(0)}, // 8 bits: 3 bits lower, 5 bits upper
{"n2kDestA", ConfigType::STRING, String("none")},
{"switchBankA", ConfigType::BYTE, uint8_t(0)},
{"n2kDestB", ConfigType::STRING, String("none")},
{"switchBankB", ConfigType::BYTE, uint8_t(0)},
{"n2kDestC", ConfigType::STRING, String("none")},
{"switchBankC", ConfigType::BYTE, uint8_t(0)},
{"envInterval", ConfigType::SHORT, int16_t(5)},
// no user access

View File

@@ -47,7 +47,14 @@
// NMEA2000 defaults
#define N2K_DEFAULT_NODEID 124
#define NMEA2000_HEARTBEAT_INTERVAL 5000 // milliseconds
#define N2K_HEARTBEAT_INTERVAL 5000 // milliseconds
#define N2K_MANUFACTURERCODE 2046 // custom OBP
#define N2K_INDUSTRYGROUP 4
#define N2K_DEVFUNCT 130 // Device function=Button Interface (or 190?)
#define N2K_DEVCLASS 110 // Device class=Human Interface? (or 140?)
#define NAME_BROADCAST 0xFFFFFFFFFFFFFFFFULL // "all"
#define NAME_NONE 0x0ULL // "none"
// Keys
#define KEY_1 GPIO_NUM_5 // D2
@@ -74,15 +81,29 @@
// #define LEDC_TIMER_8_BIT 8
// Buzzer
#define BUZZER GPIO_NUM_43 // TX
#ifdef HARDWARE_V1
#define BUZZER GPIO_NUM_43 // TX (bad: signals while booting)
#else
#define BUZZER GPIO_NUM_14 // A7
#endif
// Light sensor
#define LDR GPIO_NUM_13 // A6
// LEDS
#define LED_A GPIO_NUM_3 // A2
#define LED_B GPIO_NUM_2 // A1
#define LED_C GPIO_NUM_1 // A0
#ifdef HARDWARE_V1
#define RGBLED_R GPIO_NUM_14 // A7 red
#define RGBLED_G GPIO_NUM_13 // A6 green
#define RGBLED_B GPIO_NUM_4 // A3 blue
#else
#define RGBLED_R GPIO_NUM_12 // A5 red
#define RGBLED_G GPIO_NUM_11 // A4 green
#define RGBLED_B GPIO_NUM_4 // A3 blue
#endif
#define LED_USER GPIO_NUM_48 // internal red user led
@@ -96,19 +117,19 @@
#define CAN_RECOVERY_PERIOD 3000
// I2C temp. sensor
#ifdef HARDWARE_V1
#define I2C_SDA GPIO_NUM_11 // A4
#define I2C_SCL GPIO_NUM_12 // A5
#else
#define I2C_SDA GPIO_NUM_38 // D11
#define I2C_SCL GPIO_NUM_47 // D12
#endif
#define I2C_SPEED 100000UL // 100kHz clock speed on I2C bus
// I2C addresses
#define SHT31_ADDRESS 0x44
// SPI display connector (optional)
#define SPI_MOSI GPIO_NUM_38 // D11
#define SPI_MISO GPIO_NUM_47 // D12
#define SPI_SCK GPIO_NUM_48 // D13
#define SPI_CS GPIO_NUM_46 // B0
// Button indices
#define BUTTON_1 0
#define BUTTON_2 1
@@ -130,7 +151,6 @@ struct ButtonEvent {
};
extern uint8_t loglevel;
extern Nmea2kTwai &NMEA2000;
extern tN2kDeviceList *pN2kDeviceList;
@@ -141,8 +161,6 @@ extern char audiomode;
extern char destination;
extern uint64_t chipid;
// extern int16_t led_brightness;
// extern int16_t rgb_brightness;
extern bool ap_enabled;
extern bool buz_enabled;
extern uint8_t keycode[6];