Trunk fmt

This commit is contained in:
Ben Meadors 2024-07-09 12:16:56 -05:00
parent 9ad0addbbf
commit ba8d17b9c1
12 changed files with 47 additions and 43 deletions

View File

@ -232,11 +232,11 @@ class AnalogBatteryLevel : public HasBatteryLevel
raw = espAdcRead();
scaled = esp_adc_cal_raw_to_voltage(raw, adc_characs);
scaled *= operativeAdcMultiplier;
#else // block for all other platforms
#ifdef ADC_CTRL // enable adc voltage divider when we need to read
pinMode(ADC_CTRL, OUTPUT);
digitalWrite(ADC_CTRL, ADC_CTRL_ENABLED);
delay(10);
#else // block for all other platforms
#ifdef ADC_CTRL // enable adc voltage divider when we need to read
pinMode(ADC_CTRL, OUTPUT);
digitalWrite(ADC_CTRL, ADC_CTRL_ENABLED);
delay(10);
#endif
for (uint32_t i = 0; i < BATTERY_SENSE_SAMPLES; i++) {
raw += analogRead(BATTERY_PIN);
@ -244,7 +244,7 @@ class AnalogBatteryLevel : public HasBatteryLevel
raw = raw / BATTERY_SENSE_SAMPLES;
scaled = operativeAdcMultiplier * ((1000 * AREF_VOLTAGE) / pow(2, BATTERY_SENSE_RESOLUTION_BITS)) * raw;
#ifdef ADC_CTRL // disable adc voltage divider when we need to read
digitalWrite(ADC_CTRL, !ADC_CTRL_ENABLED);
digitalWrite(ADC_CTRL, !ADC_CTRL_ENABLED);
#endif
#endif

View File

@ -156,7 +156,8 @@ bool EInkDisplay::connect()
}
}
#elif defined(HELTEC_WIRELESS_PAPER_V1_0) || defined(HELTEC_WIRELESS_PAPER) || defined(HELTEC_VISION_MASTER_E213) || defined(HELTEC_VISION_MASTER_E290)
#elif defined(HELTEC_WIRELESS_PAPER_V1_0) || defined(HELTEC_WIRELESS_PAPER) || defined(HELTEC_VISION_MASTER_E213) || \
defined(HELTEC_VISION_MASTER_E290)
{
// Start HSPI
hspi = new SPIClass(HSPI);

View File

@ -67,7 +67,8 @@ class EInkDisplay : public OLEDDisplay
GxEPD2_BW<EINK_DISPLAY_MODEL, EINK_DISPLAY_MODEL::HEIGHT> *adafruitDisplay = NULL;
// If display uses HSPI
#if defined(HELTEC_WIRELESS_PAPER) || defined(HELTEC_WIRELESS_PAPER_V1_0) || defined(HELTEC_VISION_MASTER_E213) || defined(HELTEC_VISION_MASTER_E290)
#if defined(HELTEC_WIRELESS_PAPER) || defined(HELTEC_WIRELESS_PAPER_V1_0) || defined(HELTEC_VISION_MASTER_E213) || \
defined(HELTEC_VISION_MASTER_E290)
SPIClass *hspi = NULL;
#endif

View File

@ -1498,9 +1498,10 @@ Screen::Screen(ScanI2C::DeviceAddress address, meshtastic_Config_DisplayConfig_O
(address.port == ScanI2C::I2CPort::WIRE1) ? HW_I2C::I2C_TWO : HW_I2C::I2C_ONE);
#elif defined(USE_ST7789)
#ifdef ESP_PLATFORM
dispdev = new ST7789Spi(&SPI1, ST7789_RESET, ST7789_RS, ST7789_NSS,GEOMETRY_RAWMODE,TFT_WIDTH,TFT_HEIGHT,ST7789_SDA,ST7789_MISO,ST7789_SCK);
dispdev = new ST7789Spi(&SPI1, ST7789_RESET, ST7789_RS, ST7789_NSS, GEOMETRY_RAWMODE, TFT_WIDTH, TFT_HEIGHT, ST7789_SDA,
ST7789_MISO, ST7789_SCK);
#else
dispdev = new ST7789Spi(&SPI1, ST7789_RESET, ST7789_RS, ST7789_NSS,GEOMETRY_RAWMODE,TFT_WIDTH,TFT_HEIGHT);
dispdev = new ST7789Spi(&SPI1, ST7789_RESET, ST7789_RS, ST7789_NSS, GEOMETRY_RAWMODE, TFT_WIDTH, TFT_HEIGHT);
#endif
#elif defined(USE_SSD1306)
dispdev = new SSD1306Wire(address.address, -1, -1, geometry,
@ -1582,10 +1583,10 @@ void Screen::handleSetOn(bool on, FrameCallback einkScreensaver)
dispdev->displayOn();
#ifdef USE_ST7789
#ifdef ESP_PLATFORM
analogWrite(VTFT_LEDA,BRIGHTNESS_DEFAULT);
analogWrite(VTFT_LEDA, BRIGHTNESS_DEFAULT);
#else
pinMode(VTFT_LEDA,OUTPUT);
digitalWrite(VTFT_LEDA,TFT_BACKLIGHT_ON);
pinMode(VTFT_LEDA, OUTPUT);
digitalWrite(VTFT_LEDA, TFT_BACKLIGHT_ON);
#endif
#endif
enabled = true;
@ -1600,8 +1601,8 @@ void Screen::handleSetOn(bool on, FrameCallback einkScreensaver)
dispdev->displayOff();
#ifdef USE_ST7789
pinMode(VTFT_LEDA,OUTPUT);
digitalWrite(VTFT_LEDA,!TFT_BACKLIGHT_ON);
pinMode(VTFT_LEDA, OUTPUT);
digitalWrite(VTFT_LEDA, !TFT_BACKLIGHT_ON);
#endif
#ifdef T_WATCH_S3
@ -1618,7 +1619,7 @@ void Screen::setup()
// We don't set useDisplay until setup() is called, because some boards have a declaration of this object but the device
// is never found when probing i2c and therefore we don't call setup and never want to do (invalid) accesses to this device.
useDisplay = true;
#ifdef AutoOLEDWire_h
if (isAUTOOled)
static_cast<AutoOLEDWire *>(dispdev)->setDetected(model);

View File

@ -716,7 +716,8 @@ void setup()
// Don't call screen setup until after nodedb is setup (because we need
// the current region name)
#if defined(ST7735_CS) || defined(USE_EINK) || defined(ILI9341_DRIVER) || defined(ST7789_CS) || defined(HX8357_CS) || defined(USE_ST7789)
#if defined(ST7735_CS) || defined(USE_EINK) || defined(ILI9341_DRIVER) || defined(ST7789_CS) || defined(HX8357_CS) || \
defined(USE_ST7789)
screen->setup();
#elif defined(ARCH_PORTDUINO)
if (screen_found.port != ScanI2C::I2CPort::NO_I2C || settingsMap[displayPanel]) {

View File

@ -268,7 +268,8 @@ void NodeDB::installDefaultConfig()
// FIXME: Default to bluetooth capability of platform as default
config.bluetooth.enabled = true;
config.bluetooth.fixed_pin = defaultBLEPin;
#if defined(ST7735_CS) || defined(USE_EINK) || defined(ILI9341_DRIVER) || defined(ST7789_CS) || defined(HX8357_CS) || defined(USE_ST7789)
#if defined(ST7735_CS) || defined(USE_EINK) || defined(ILI9341_DRIVER) || defined(ST7789_CS) || defined(HX8357_CS) || \
defined(USE_ST7789)
bool hasScreen = true;
#elif ARCH_PORTDUINO
bool hasScreen = false;

View File

@ -258,7 +258,7 @@ void doDeepSleep(uint32_t msecToWake, bool skipPreflight = false)
digitalWrite(VEXT_ENABLE_V05, 0); // turn off the lora amplifier power
digitalWrite(ST7735_BL_V05, 0); // turn off the display power
#elif defined(VEXT_ENABLE) && defined(VEXT_ON_VALUE)
digitalWrite(VEXT_ENABLE, !VEXT_ON_VALUE); // turn on the display power
digitalWrite(VEXT_ENABLE, !VEXT_ON_VALUE); // turn on the display power
#elif defined(VEXT_ENABLE)
digitalWrite(VEXT_ENABLE, 1); // turn off the display power
#endif

View File

@ -1,5 +1,5 @@
#define LED_PIN 33
#define LED_PIN2 34
#define LED_PIN2 34
#define EXT_PWR_DETECT 35
#define BUTTON_PIN 18

View File

@ -53,14 +53,13 @@ extern "C" {
#define SPI_FREQUENCY 40000000
#define SPI_READ_FREQUENCY 16000000
#define TFT_HEIGHT 135
#define TFT_WIDTH 240
#define TFT_WIDTH 240
#define TFT_OFFSET_X 0
#define TFT_OFFSET_Y 0
// #define TFT_OFFSET_ROTATION 0
// #define SCREEN_ROTATE
// #define SCREEN_TRANSITION_FRAMERATE 5
// Number of pins defined in PinDescription array
#define PINS_COUNT (48)
#define NUM_DIGITAL_PINS (48)
@ -70,7 +69,7 @@ extern "C" {
// LEDs
#define PIN_LED1 (32 + 3) // 13 red (confirmed on 1.0 board)
// Unused(by firmware) LEDs:
#define PIN_LED2 (1 + 1) // 14 blue
#define PIN_LED2 (1 + 1) // 14 blue
#define PIN_LED3 (1 + 11) // 15 green
#define LED_RED PIN_LED3
@ -87,7 +86,8 @@ extern "C" {
* Buttons
*/
#define PIN_BUTTON1 (32 + 10)
//#define PIN_BUTTON2 (0 + 18) // 0.18 is labeled on the board as RESET but we configure it in the bootloader as a regular GPIO
// #define PIN_BUTTON2 (0 + 18) // 0.18 is labeled on the board as RESET but we configure it in the bootloader as a regular
// GPIO
/*
No longer populated on PCB
@ -104,7 +104,6 @@ No longer populated on PCB
#define PIN_WIRE_SDA (26)
#define PIN_WIRE_SCL (27)
// QSPI Pins
#define PIN_QSPI_SCK (32 + 14)
#define PIN_QSPI_CS (32 + 15)
@ -124,21 +123,23 @@ No longer populated on PCB
#define USE_SX1262
// #define USE_SX1268
#define SX126X_CS (0 + 24) // FIXME - we really should define LORA_CS instead
#define LORA_CS (0 + 24)
#define LORA_CS (0 + 24)
#define SX126X_DIO1 (0 + 20)
// Note DIO2 is attached internally to the module to an analog switch for TX/RX switching
//#define SX1262_DIO3 \
// (0 + 21) // This is used as an *output* from the sx1262 and connected internally to power the tcxo, do not drive from the main
// CPU?
// #define SX1262_DIO3 \
// (0 + 21) // This is used as an *output* from the sx1262 and connected internally to power the tcxo, do not drive from the
// main
// CPU?
#define SX126X_BUSY (0 + 17)
#define SX126X_RESET (0 + 25)
// Not really an E22 but TTGO seems to be trying to clone that
#define SX126X_DIO2_AS_RF_SWITCH
#define SX126X_DIO3_TCXO_VOLTAGE 1.8
#define PIN_SPI1_MISO ST7789_MISO // FIXME not really needed, but for now the SPI code requires something to be defined, pick an used GPIO
#define PIN_SPI1_MOSI ST7789_SDA
#define PIN_SPI1_SCK ST7789_SCK
#define PIN_SPI1_MISO \
ST7789_MISO // FIXME not really needed, but for now the SPI code requires something to be defined, pick an used GPIO
#define PIN_SPI1_MOSI ST7789_SDA
#define PIN_SPI1_SCK ST7789_SCK
/*
* GPS pins
@ -146,12 +147,12 @@ No longer populated on PCB
#define GPS_L76K
#define PIN_GPS_RESET (32 + 6) // An output to reset L76K GPS. As per datasheet, low for > 100ms will reset the L76K
#define PIN_GPS_RESET (32 + 6) // An output to reset L76K GPS. As per datasheet, low for > 100ms will reset the L76K
#define GPS_RESET_MODE LOW
#define PIN_GPS_EN (21)
#define GPS_EN_ACTIVE HIGH
#define PIN_GPS_STANDBY (32 + 2) // An output to wake GPS, low means allow sleep, high means force wake
#define PIN_GPS_PPS (32+4)
#define PIN_GPS_PPS (32 + 4)
// Seems to be missing on this new board
// #define PIN_GPS_PPS (32 + 4) // Pulse per second input from the GPS
#define GPS_TX_PIN (32 + 5) // This is for bits going TOWARDS the CPU
@ -175,7 +176,7 @@ No longer populated on PCB
#define PIN_SPI_MOSI (0 + 22)
#define PIN_SPI_SCK (0 + 19)
//#define PIN_PWR_EN (0 + 6)
// #define PIN_PWR_EN (0 + 6)
// To debug via the segger JLINK console rather than the CDC-ACM serial device
// #define USE_SEGGER

View File

@ -33,7 +33,7 @@
#define ADC_CTRL_ENABLED HIGH
#define BATTERY_PIN 7
#define ADC_CHANNEL ADC1_GPIO7_CHANNEL
#define ADC_MULTIPLIER 4.9*1.03 // Voltage divider is roughly 1:1
#define ADC_MULTIPLIER 4.9 * 1.03 // Voltage divider is roughly 1:1
#define ADC_ATTENUATION ADC_ATTEN_DB_2_5 // Voltage divider output is quite high
#define USE_SX1262

View File

@ -21,9 +21,9 @@
*/
#define SPI_INTERFACES_COUNT 2
#define PIN_SPI_MISO 10 // MISO
#define PIN_SPI_MOSI 11 // MOSI
#define PIN_SPI_SCK 9 // SCK
#define PIN_SPI_MISO 10 // MISO
#define PIN_SPI_MOSI 11 // MOSI
#define PIN_SPI_SCK 9 // SCK
#define VEXT_ENABLE 18 // powers the e-ink display
#define VEXT_ON_VALUE 1
@ -33,7 +33,7 @@
#define ADC_CTRL_ENABLED HIGH
#define BATTERY_PIN 7
#define ADC_CHANNEL ADC1_GPIO7_CHANNEL
#define ADC_MULTIPLIER 4.9*1.03
#define ADC_MULTIPLIER 4.9 * 1.03
#define ADC_ATTENUATION ADC_ATTEN_DB_2_5 // Voltage divider output is quite high
#define USE_SX1262

View File

@ -33,10 +33,8 @@
// #define SCREEN_TRANSITION_FRAMERATE 5
#define BRIGHTNESS_DEFAULT 100 // Medium Low Brightnes
// #define SLEEP_TIME 120
/*
* SPI interfaces
*/
@ -53,7 +51,7 @@
#define ADC_CTRL_ENABLED HIGH
#define BATTERY_PIN 6
#define ADC_CHANNEL ADC1_GPIO6_CHANNEL
#define ADC_MULTIPLIER 4.9*1.03 // Voltage divider is roughly 1:1
#define ADC_MULTIPLIER 4.9 * 1.03 // Voltage divider is roughly 1:1
#define ADC_ATTENUATION ADC_ATTEN_DB_2_5 // Voltage divider output is quite high
#define USE_SX1262