From ab3284ecb1adc56ae6ea0454436ee6c83d2d0838 Mon Sep 17 00:00:00 2001 From: Tyeth Gundry Date: Thu, 19 Jun 2025 16:30:53 +0100 Subject: [PATCH 01/16] Add SH1107 for 128x64/32 OLED featherwings --- library.properties | 2 +- platformio.ini | 1 + src/components/i2c/WipperSnapper_I2C.cpp | 25 +++ src/components/i2c/WipperSnapper_I2C.h | 1 + .../WipperSnapper_I2C_Driver_Out_Sh1107.h | 158 ++++++++++++++++++ 5 files changed, 186 insertions(+), 1 deletion(-) create mode 100644 src/components/i2c/drivers/WipperSnapper_I2C_Driver_Out_Sh1107.h diff --git a/library.properties b/library.properties index 77037f3b6..d227d9c7e 100644 --- a/library.properties +++ b/library.properties @@ -7,4 +7,4 @@ paragraph=Arduino application for Adafruit.io WipperSnapper category=Communication url=https://github.com/adafruit/Adafruit_Wippersnapper_Arduino architectures=* -depends=SdFat - Adafruit Fork, Adafruit NeoPixel, Adafruit SPIFlash, ArduinoJson, Adafruit DotStar, Adafruit HDC302x, Adafruit INA219, Adafruit INA260 Library, Adafruit LTR329 and LTR303, Adafruit LTR390 Library, Adafruit MCP3421, Adafruit NAU7802 Library, Adafruit SleepyDog Library, Adafruit TMP117, Adafruit TinyUSB Library, Adafruit AHTX0, Adafruit BME280 Library, Adafruit BMP280 Library, Adafruit BMP3XX Library, Adafruit DPS310, Adafruit DS248x, Adafruit SCD30, Adafruit SGP30 Sensor, Adafruit SGP40 Sensor, Sensirion I2C SCD4x, Sensirion I2C SEN5X, Sensirion I2C SEN66, arduino-sht, Adafruit Si7021 Library, Adafruit MQTT Library, Adafruit MS8607, Adafruit MCP9808 Library, Adafruit MCP9600 Library, Adafruit MPL115A2, Adafruit MPRLS Library, Adafruit TSL2591 Library, Adafruit_VL53L0X, Adafruit VL53L1X, STM32duino VL53L4CD, STM32duino VL53L4CX, Adafruit_VL6180X, Adafruit PM25 AQI Sensor, Adafruit VCNL4020 Library, Adafruit VCNL4040, Adafruit VCNL4200 Library, Adafruit VEML7700 Library, Adafruit LC709203F, Adafruit LPS2X, Adafruit LPS28, Adafruit LPS35HW, Adafruit seesaw Library, Adafruit BME680 Library, Adafruit MAX1704X, Adafruit ADT7410 Library, Adafruit HTS221, Adafruit HTU21DF Library, Adafruit HTU31D Library, Adafruit PCT2075, hp_BH1750, ENS160 - Adafruit Fork, Adafruit BusIO, Adafruit Unified Sensor, Sensirion Core, Adafruit GFX Library, Adafruit LED Backpack Library, Adafruit LiquidCrystal, Adafruit SSD1306 +depends=SdFat - Adafruit Fork, Adafruit NeoPixel, Adafruit SPIFlash, ArduinoJson, Adafruit DotStar, Adafruit HDC302x, Adafruit INA219, Adafruit INA260 Library, Adafruit LTR329 and LTR303, Adafruit LTR390 Library, Adafruit MCP3421, Adafruit NAU7802 Library, Adafruit SleepyDog Library, Adafruit TMP117, Adafruit TinyUSB Library, Adafruit AHTX0, Adafruit BME280 Library, Adafruit BMP280 Library, Adafruit BMP3XX Library, Adafruit DPS310, Adafruit DS248x, Adafruit SCD30, Adafruit SGP30 Sensor, Adafruit SGP40 Sensor, Sensirion I2C SCD4x, Sensirion I2C SEN5X, Sensirion I2C SEN66, arduino-sht, Adafruit Si7021 Library, Adafruit MQTT Library, Adafruit MS8607, Adafruit MCP9808 Library, Adafruit MCP9600 Library, Adafruit MPL115A2, Adafruit MPRLS Library, Adafruit TSL2591 Library, Adafruit_VL53L0X, Adafruit VL53L1X, STM32duino VL53L4CD, STM32duino VL53L4CX, Adafruit_VL6180X, Adafruit PM25 AQI Sensor, Adafruit VCNL4020 Library, Adafruit VCNL4040, Adafruit VCNL4200 Library, Adafruit VEML7700 Library, Adafruit LC709203F, Adafruit LPS2X, Adafruit LPS28, Adafruit LPS35HW, Adafruit seesaw Library, Adafruit BME680 Library, Adafruit MAX1704X, Adafruit ADT7410 Library, Adafruit HTS221, Adafruit HTU21DF Library, Adafruit HTU31D Library, Adafruit PCT2075, hp_BH1750, ENS160 - Adafruit Fork, Adafruit BusIO, Adafruit Unified Sensor, Sensirion Core, Adafruit GFX Library, Adafruit LED Backpack Library, Adafruit LiquidCrystal, Adafruit SH110X, Adafruit SSD1306 diff --git a/platformio.ini b/platformio.ini index bddb00c06..61578b052 100644 --- a/platformio.ini +++ b/platformio.ini @@ -84,6 +84,7 @@ lib_deps = adafruit/Adafruit LiquidCrystal adafruit/Adafruit LED Backpack Library adafruit/Adafruit PM25 AQI Sensor + adafruit/Adafruit SH110X adafruit/Adafruit SSD1306 https://github.com/pstolarz/OneWireNg.git https://github.com/milesburton/Arduino-Temperature-Control-Library.git diff --git a/src/components/i2c/WipperSnapper_I2C.cpp b/src/components/i2c/WipperSnapper_I2C.cpp index 6f58f4c27..bb15f1256 100644 --- a/src/components/i2c/WipperSnapper_I2C.cpp +++ b/src/components/i2c/WipperSnapper_I2C.cpp @@ -881,6 +881,31 @@ bool WipperSnapper_Component_I2C::initI2CDevice( } _drivers_out.push_back(_sevenSeg); WS_DEBUG_PRINTLN("7-Segement LED Matrix Initialized Successfully!"); + } else if (strcmp("oled128x32wingdefault", msgDeviceInitReq->i2c_device_name) == + 0 || + strcmp("oled128x32winglarge", msgDeviceInitReq->i2c_device_name) == + 0 || + strcmp("oled128x64wingdefault", msgDeviceInitReq->i2c_device_name) == + 0 || + strcmp("oled128x64winglarge", msgDeviceInitReq->i2c_device_name) == + 0) { + WS_DEBUG_PRINTLN("SH1107 display detected!"); + _sh1107 = new WipperSnapper_I2C_Driver_Out_SH1107(this->_i2c, i2cAddress); + WS_DEBUG_PRINTLN("Configuring SH1107 display..."); + _sh1107->ConfigureSH1107( + (uint8_t)msgDeviceInitReq->i2c_output_add.config.ssd1306_config.width, + (uint8_t)msgDeviceInitReq->i2c_output_add.config.ssd1306_config.height, + (uint8_t) + msgDeviceInitReq->i2c_output_add.config.ssd1306_config.text_size); + if (!_sh1107->begin()) { + WS_DEBUG_PRINTLN("ERROR: Failed to initialize sh1107!"); + _busStatusResponse = + wippersnapper_i2c_v1_BusResponse_BUS_RESPONSE_DEVICE_INIT_FAIL; + return false; + } + WS_DEBUG_PRINTLN("SH1107 display configured successfully!"); + _drivers_out.push_back(_sh1107); + WS_DEBUG_PRINTLN("SH1107 display initialized Successfully!"); } else if (strcmp("oled128x32default", msgDeviceInitReq->i2c_device_name) == 0 || strcmp("oled128x32large", msgDeviceInitReq->i2c_device_name) == diff --git a/src/components/i2c/WipperSnapper_I2C.h b/src/components/i2c/WipperSnapper_I2C.h index 1c17de10a..986806196 100644 --- a/src/components/i2c/WipperSnapper_I2C.h +++ b/src/components/i2c/WipperSnapper_I2C.h @@ -54,6 +54,7 @@ #include "drivers/WipperSnapper_I2C_Driver_Out_7Seg.h" #include "drivers/WipperSnapper_I2C_Driver_Out_CharLcd.h" #include "drivers/WipperSnapper_I2C_Driver_Out_QuadAlphaNum.h" +#include "drivers/WipperSnapper_I2C_Driver_Out_Sh1107.h" #include "drivers/WipperSnapper_I2C_Driver_Out_Ssd1306.h" #include "drivers/WipperSnapper_I2C_Driver_PCT2075.h" #include "drivers/WipperSnapper_I2C_Driver_PM25.h" diff --git a/src/components/i2c/drivers/WipperSnapper_I2C_Driver_Out_Sh1107.h b/src/components/i2c/drivers/WipperSnapper_I2C_Driver_Out_Sh1107.h new file mode 100644 index 000000000..0b5c7c757 --- /dev/null +++ b/src/components/i2c/drivers/WipperSnapper_I2C_Driver_Out_Sh1107.h @@ -0,0 +1,158 @@ +/*! + * @file WipperSnapper_I2C_Driver_Out_SH1107.h + * + * Device driver for a SH1107 OLED Display + * + * Adafruit invests time and resources providing this open source code, + * please support Adafruit and open-source hardware by purchasing + * products from Adafruit! + * + * Copyright (c) Brent Rubell for Adafruit Industries 2025 + * + * MIT license, all text here must be included in any redistribution. + * + */ + +#ifndef WIPPERSNAPPER_I2C_DRIVER_OUT_SH1107_H +#define WIPPERSNAPPER_I2C_DRIVER_OUT_SH1107_H + +#include "WipperSnapper_I2C_Driver_Out.h" +#include +#include + +#define DEFAULT_WIDTH 128 ///< Default width for a sh1107 128x64 display +#define DEFAULT_HEIGHT 64 ///< Default height for a sh1107 128x64 display + +/*! + @brief Class that provides a driver interface for a SH1107 + OLED Display +*/ +class WipperSnapper_I2C_Driver_Out_SH1107 + : public WipperSnapper_I2C_Driver_Out { + +public: + /*******************************************************************************/ + /*! + @brief Constructor for a SH1107 OLED display. + @param i2c + The I2C interface. + @param sensorAddress + 7-bit device address. + */ + /*******************************************************************************/ + WipperSnapper_I2C_Driver_Out_SH1107(TwoWire *i2c, uint16_t sensorAddress) + : WipperSnapper_I2C_Driver_Out(i2c, sensorAddress) { + _i2c = i2c; + _sensorAddress = sensorAddress; + _width = DEFAULT_WIDTH; + _height = DEFAULT_HEIGHT; + } + + /*! + @brief Destructor for a SH1107 OLED display. + */ + ~WipperSnapper_I2C_Driver_Out_SH1107() { + if (_display != nullptr) { + _display->clearDisplay(); + _display->display(); + _display->sh1107_command(SH1107_DISPLAYOFF); + delete _display; + _display = nullptr; + } + } + + /*! + @brief Initializes the SH1107 display and begins I2C. + @returns True if initialized successfully, False otherwise. + */ + bool begin() { + // Attempt to create and allocate a SH1107 obj. + _display = new Adafruit_SH1107(_width, _height, _i2c); + if (!_display->begin(_sensorAddress, true)) + return false; + // Configure the text size and color + _display->setTextSize(_text_sz); + _display->setTextColor(SH1107_WHITE); + // Use full 256 char 'Code Page 437' font + _display->cp437(true); + // Clear the buffer + _display->clearDisplay(); + _display->display(); + return true; + } + + /*! + @brief Configures a SH1107 OLED display. Must be called before driver + begin() + @param width + The width of the display in pixels. + @param height + The height of the display in pixels. + @param text_size + The magnification factor for the text size. + */ + void ConfigureSH1107(uint8_t width, uint8_t height, uint8_t text_size) { + _width = width; + _height = height; + _text_sz = text_size; + } + + /*! + @brief Writes a message to the SH1107 display. + @param message + The message to be displayed. + */ + void WriteMessageSH1107(const char *message) { + if (_display == nullptr) + return; + + // Start with a fresh display buffer + // and settings + int16_t y_idx = 0; + _display->clearDisplay(); + _display->setTextSize(_text_sz); + _display->setTextColor(SH1107_WHITE); + _display->setCursor(0, y_idx); + _display->display(); + + // Calculate the line height based on the text size (NOTE: base height is + // 8px) + int16_t line_height = 8 * _text_sz; + uint16_t c_idx = 0; + size_t msg_size = strlen(message); + for (size_t i = 0; i < msg_size && c_idx < msg_size; i++) { + if (message[i] == '\\' && i + 1 < msg_size && + (message[i + 1] == 'n' || message[i + 1] == 'r')) { + // Handle \r\n sequence as a single newline + if (message[i + 1] == 'r' && i + 3 < msg_size && + message[i + 2] == '\\' && message[i + 3] == 'n') { + // Skip to the next line + y_idx += line_height; + _display->setCursor(0, y_idx); + i += 3; + } else if (message[i + 1] == 'n') { + // Skip to the next line + y_idx += line_height; + _display->setCursor(0, y_idx); + i++; + } + } else if (message[i] == 0xC2 && message[i + 1] == 0xB0) { + _display->write(char(248)); + _display->display(); + i++; + } else { + _display->print(message[i]); + _display->display(); + } + } + } + +protected: + Adafruit_SH1107 *_display = + nullptr; ///< Pointer to the Adafruit_SH1107 object + uint8_t _width; ///< Width of the display in pixels + uint8_t _height; ///< Height of the display in pixels + uint8_t _text_sz; ///< Text size of the display +}; + +#endif // WIPPERSNAPPER_I2C_DRIVER_OUT_SH1107_H \ No newline at end of file From cdc6588e57bdfa1a36493c11e74f542c00d2be77 Mon Sep 17 00:00:00 2001 From: Tyeth Gundry Date: Thu, 19 Jun 2025 16:41:40 +0100 Subject: [PATCH 02/16] Add 128x32 OLED featherwings as SSD1306 --- .github/workflows/build-clang-doxy.yml | 69 ++++++++++++++++++ src/components/i2c/WipperSnapper_I2C.cpp | 14 ++-- src/components/i2c/WipperSnapper_I2C.h | 1 + .../WipperSnapper_I2C_Driver_Out_Sh1107.h | 73 ++++++++++++++++--- .../WipperSnapper_I2C_Driver_Out_Ssd1306.h | 5 ++ 5 files changed, 145 insertions(+), 17 deletions(-) diff --git a/.github/workflows/build-clang-doxy.yml b/.github/workflows/build-clang-doxy.yml index e0d912256..a060c52bc 100644 --- a/.github/workflows/build-clang-doxy.yml +++ b/.github/workflows/build-clang-doxy.yml @@ -5,6 +5,11 @@ name: WipperSnapper Build CI on: workflow_dispatch: + inputs: + board: + description: 'Build ONLY this board (must match a matrix entry exactly, or leave empty for all)' + required: false + default: '' pull_request: workflow_call: secrets: @@ -15,6 +20,7 @@ jobs: build-esp32sx-esptool: name: 🏗️ESP32-Sx(lvgl) runs-on: ubuntu-latest + continue-on-error: true strategy: fail-fast: false matrix: @@ -22,6 +28,13 @@ jobs: include: - offset: "0x1000" steps: + - name: "skip if unwanted" + if: | + github.event_name == 'workflow_dispatch' && + github.event.inputs.board != '' && + matrix.arduino-platform != github.event.inputs.board + run: | + echo "don't build this one!"; exit 1 - uses: actions/setup-python@v5 with: python-version: "3.x" @@ -174,6 +187,7 @@ jobs: build-esp32sx: name: 🏗️ESP32-Sx runs-on: ubuntu-latest + continue-on-error: true strategy: fail-fast: false matrix: @@ -194,6 +208,13 @@ jobs: "qtpy_esp32s3_n4r2", ] steps: + - name: "skip if unwanted" + if: | + github.event_name == 'workflow_dispatch' && + github.event.inputs.board != '' && + matrix.arduino-platform != github.event.inputs.board + run: | + echo "don't build this one!"; exit 1 - uses: actions/setup-python@v5 with: python-version: "3.x" @@ -278,6 +299,7 @@ jobs: build-esp32: name: 🏗️ESP32/Cx runs-on: ubuntu-latest + continue-on-error: true strategy: fail-fast: false matrix: @@ -299,6 +321,13 @@ jobs: - offset: "0x0" arduino-platform: "wippersnapper_feather_esp32c6" steps: + - name: "skip if unwanted" + if: | + github.event_name == 'workflow_dispatch' && + github.event.inputs.board != '' && + matrix.arduino-platform != github.event.inputs.board + run: | + echo "don't build this one!"; exit 1 - uses: actions/setup-python@v5 with: python-version: "3.x" @@ -419,6 +448,7 @@ jobs: build-samd: name: 🏗️SAMD runs-on: ubuntu-latest + continue-on-error: true strategy: fail-fast: false matrix: @@ -429,6 +459,13 @@ jobs: "metro_m4_airliftlite_tinyusb", ] steps: + - name: "skip if unwanted" + if: | + github.event_name == 'workflow_dispatch' && + github.event.inputs.board != '' && + matrix.arduino-platform != github.event.inputs.board + run: | + echo "don't build this one!"; exit 1 - uses: actions/setup-python@v5 with: python-version: "3.x" @@ -498,11 +535,19 @@ jobs: build-rp2040: name: 🏗️RP2040 runs-on: ubuntu-latest + continue-on-error: true strategy: fail-fast: false matrix: arduino-platform: ["picow_rp2040_tinyusb", "picow_rp2350_tinyusb"] steps: + - name: "skip if unwanted" + if: | + github.event_name == 'workflow_dispatch' && + github.event.inputs.board != '' && + matrix.arduino-platform != github.event.inputs.board + run: | + echo "don't build this one!"; exit 1 - uses: actions/setup-python@v5 with: python-version: "3.x" @@ -569,11 +614,19 @@ jobs: build-esp8266: name: 🏗️ESP8266 runs-on: ubuntu-latest + continue-on-error: true strategy: fail-fast: false matrix: arduino-platform: ["feather_esp8266"] steps: + - name: "skip if unwanted" + if: | + github.event_name == 'workflow_dispatch' && + github.event.inputs.board != '' && + matrix.arduino-platform != github.event.inputs.board + run: | + echo "don't build this one!"; exit 1 - uses: actions/setup-python@v5 with: python-version: "3.x" @@ -647,6 +700,7 @@ jobs: build-esp32sx-dev: name: 🏗️ESP32-Sx(DEV) runs-on: ubuntu-latest + continue-on-error: true strategy: fail-fast: false matrix: @@ -662,6 +716,13 @@ jobs: "metro_esp32s3_debug", ] steps: + - name: "skip if unwanted" + if: | + github.event_name == 'workflow_dispatch' && + github.event.inputs.board != '' && + matrix.arduino-platform != github.event.inputs.board + run: | + echo "don't build this one!"; exit 1 - uses: actions/setup-python@v5 with: python-version: "3.x" @@ -746,6 +807,7 @@ jobs: build-esp32-dev: name: 🏗️ESP32/Cx(DEV) runs-on: ubuntu-latest + continue-on-error: true strategy: fail-fast: false matrix: @@ -758,6 +820,13 @@ jobs: - offset: "0x0" arduino-platform: "wippersnapper_feather_esp32c6_debug" steps: + - name: "skip if unwanted" + if: | + github.event_name == 'workflow_dispatch' && + github.event.inputs.board != '' && + matrix.arduino-platform != github.event.inputs.board + run: | + echo "don't build this one!"; exit 1 - uses: actions/setup-python@v5 with: python-version: "3.x" diff --git a/src/components/i2c/WipperSnapper_I2C.cpp b/src/components/i2c/WipperSnapper_I2C.cpp index bb15f1256..cf8f27e28 100644 --- a/src/components/i2c/WipperSnapper_I2C.cpp +++ b/src/components/i2c/WipperSnapper_I2C.cpp @@ -881,12 +881,8 @@ bool WipperSnapper_Component_I2C::initI2CDevice( } _drivers_out.push_back(_sevenSeg); WS_DEBUG_PRINTLN("7-Segement LED Matrix Initialized Successfully!"); - } else if (strcmp("oled128x32wingdefault", msgDeviceInitReq->i2c_device_name) == - 0 || - strcmp("oled128x32winglarge", msgDeviceInitReq->i2c_device_name) == - 0 || - strcmp("oled128x64wingdefault", msgDeviceInitReq->i2c_device_name) == - 0 || + } else if (strcmp("oled128x64wingdefault", + msgDeviceInitReq->i2c_device_name) == 0 || strcmp("oled128x64winglarge", msgDeviceInitReq->i2c_device_name) == 0) { WS_DEBUG_PRINTLN("SH1107 display detected!"); @@ -906,7 +902,11 @@ bool WipperSnapper_Component_I2C::initI2CDevice( WS_DEBUG_PRINTLN("SH1107 display configured successfully!"); _drivers_out.push_back(_sh1107); WS_DEBUG_PRINTLN("SH1107 display initialized Successfully!"); - } else if (strcmp("oled128x32default", msgDeviceInitReq->i2c_device_name) == + } else if (strcmp("oled128x32wingdefault", + msgDeviceInitReq->i2c_device_name) == 0 || + strcmp("oled128x32winglarge", msgDeviceInitReq->i2c_device_name) == + 0 || + strcmp("oled128x32default", msgDeviceInitReq->i2c_device_name) == 0 || strcmp("oled128x32large", msgDeviceInitReq->i2c_device_name) == 0 || diff --git a/src/components/i2c/WipperSnapper_I2C.h b/src/components/i2c/WipperSnapper_I2C.h index 986806196..b9cddd0f4 100644 --- a/src/components/i2c/WipperSnapper_I2C.h +++ b/src/components/i2c/WipperSnapper_I2C.h @@ -205,6 +205,7 @@ class WipperSnapper_Component_I2C { WipperSnapper_I2C_Driver_Out_QuadAlphaNum *_quadAlphaNum = nullptr; WipperSnapper_I2C_Driver_Out_CharLcd *_charLcd = nullptr; WipperSnapper_I2C_Driver_Out_7Seg *_sevenSeg = nullptr; + WipperSnapper_I2C_Driver_Out_SH1107 *_sh1107 = nullptr; WipperSnapper_I2C_Driver_Out_Ssd1306 *_ssd1306 = nullptr; }; extern Wippersnapper WS; diff --git a/src/components/i2c/drivers/WipperSnapper_I2C_Driver_Out_Sh1107.h b/src/components/i2c/drivers/WipperSnapper_I2C_Driver_Out_Sh1107.h index 0b5c7c757..172d4ca18 100644 --- a/src/components/i2c/drivers/WipperSnapper_I2C_Driver_Out_Sh1107.h +++ b/src/components/i2c/drivers/WipperSnapper_I2C_Driver_Out_Sh1107.h @@ -17,7 +17,9 @@ #define WIPPERSNAPPER_I2C_DRIVER_OUT_SH1107_H #include "WipperSnapper_I2C_Driver_Out.h" -#include +// #include +#include +#include #include #define DEFAULT_WIDTH 128 ///< Default width for a sh1107 128x64 display @@ -33,7 +35,7 @@ class WipperSnapper_I2C_Driver_Out_SH1107 public: /*******************************************************************************/ /*! - @brief Constructor for a SH1107 OLED display. + @brief Constructor for a OLED display. @param i2c The I2C interface. @param sensorAddress @@ -55,7 +57,7 @@ class WipperSnapper_I2C_Driver_Out_SH1107 if (_display != nullptr) { _display->clearDisplay(); _display->display(); - _display->sh1107_command(SH1107_DISPLAYOFF); + _display->oled_command(SH110X_DISPLAYOFF); delete _display; _display = nullptr; } @@ -66,18 +68,35 @@ class WipperSnapper_I2C_Driver_Out_SH1107 @returns True if initialized successfully, False otherwise. */ bool begin() { - // Attempt to create and allocate a SH1107 obj. - _display = new Adafruit_SH1107(_width, _height, _i2c); + // Attempt to create and allocate a SH1107 obj, backwards w/h + _display = new Adafruit_SH1107(_height, _width, _i2c); if (!_display->begin(_sensorAddress, true)) return false; + + // Show image buffer on the display hardware. + // Since the buffer is intialized with an Adafruit splashscreen + // internally, this will display the splashscreen. + _display->display(); + delay(1700); + + // Clear the buffer. + _display->clearDisplay(); + _display->display(); + _display->setRotation(1); + // Configure the text size and color _display->setTextSize(_text_sz); - _display->setTextColor(SH1107_WHITE); + _display->setTextColor(SH110X_WHITE); + _display->setCursor(0, 0); // Use full 256 char 'Code Page 437' font - _display->cp437(true); + // _display->cp437(true); // Clear the buffer _display->clearDisplay(); _display->display(); + _display->print(char('a')); + delay(500); + _display->write(char('b')); + _display->display(); return true; } @@ -95,7 +114,25 @@ class WipperSnapper_I2C_Driver_Out_SH1107 _width = width; _height = height; _text_sz = text_size; + WS_DEBUG_PRINT("SH1107 text size: "); + WS_DEBUG_PRINTLN(text_size); } + /*! + @brief Configures a SSD1306 OLED display. Must be called before driver + begin() - This is a fake function to match the SSD1306 interface. + @param width + The width of the display in pixels. + @param height + The height of the display in pixels. + @param text_size + The magnification factor for the text size. + */ + void ConfigureSSD1306(uint8_t width, uint8_t height, + uint8_t text_size) { + // This is a SH1107, not a SSD1306, so we don't need to do anything here. + ConfigureSH1107(width, height, text_size); + } + /*! @brief Writes a message to the SH1107 display. @@ -105,13 +142,14 @@ class WipperSnapper_I2C_Driver_Out_SH1107 void WriteMessageSH1107(const char *message) { if (_display == nullptr) return; - + WS_DEBUG_PRINT("SH1107 Message:"); + WS_DEBUG_PRINTLN(message); // Start with a fresh display buffer // and settings int16_t y_idx = 0; _display->clearDisplay(); _display->setTextSize(_text_sz); - _display->setTextColor(SH1107_WHITE); + _display->setTextColor(SH110X_WHITE); _display->setCursor(0, y_idx); _display->display(); @@ -128,11 +166,15 @@ class WipperSnapper_I2C_Driver_Out_SH1107 message[i + 2] == '\\' && message[i + 3] == 'n') { // Skip to the next line y_idx += line_height; + WS_DEBUG_PRINT("SH1107 Newline at: "); + WS_DEBUG_PRINTLN(y_idx); _display->setCursor(0, y_idx); i += 3; } else if (message[i + 1] == 'n') { // Skip to the next line y_idx += line_height; + WS_DEBUG_PRINT("SH1107 Newline at: "); + WS_DEBUG_PRINTLN(y_idx); _display->setCursor(0, y_idx); i++; } @@ -147,6 +189,17 @@ class WipperSnapper_I2C_Driver_Out_SH1107 } } + + /*! + @brief Writes a message to the fake "SSD1306" SH1107 display. + @param msg_write + Pointer to a wippersnapper_i2c_v1_SSD1306Write message. + */ + void WriteMessageSSD1306(const char *message) { + // This is a SH1107, not a SSD1306, so we just call the SH1107 write + WriteMessageSH1107(message); + } + protected: Adafruit_SH1107 *_display = nullptr; ///< Pointer to the Adafruit_SH1107 object @@ -155,4 +208,4 @@ class WipperSnapper_I2C_Driver_Out_SH1107 uint8_t _text_sz; ///< Text size of the display }; -#endif // WIPPERSNAPPER_I2C_DRIVER_OUT_SH1107_H \ No newline at end of file +#endif // WIPPERSNAPPER_I2C_DRIVER_OUT_SH1107_H diff --git a/src/components/i2c/drivers/WipperSnapper_I2C_Driver_Out_Ssd1306.h b/src/components/i2c/drivers/WipperSnapper_I2C_Driver_Out_Ssd1306.h index 40bfd95bb..6c8b25e7d 100644 --- a/src/components/i2c/drivers/WipperSnapper_I2C_Driver_Out_Ssd1306.h +++ b/src/components/i2c/drivers/WipperSnapper_I2C_Driver_Out_Ssd1306.h @@ -95,6 +95,8 @@ class WipperSnapper_I2C_Driver_Out_Ssd1306 _width = width; _height = height; _text_sz = text_size; + WS_DEBUG_PRINT("SSD1306 text size: "); + WS_DEBUG_PRINTLN(text_size); } /*! @@ -106,6 +108,9 @@ class WipperSnapper_I2C_Driver_Out_Ssd1306 if (_display == nullptr) return; + WS_DEBUG_PRINT("SSD1306 Message:"); + WS_DEBUG_PRINTLN(message); + // Start with a fresh display buffer // and settings int16_t y_idx = 0; From 3d3d44b5ab54d849d40050be9ae24e0f7846dcd3 Mon Sep 17 00:00:00 2001 From: tyeth Date: Fri, 20 Jun 2025 18:19:16 +0100 Subject: [PATCH 03/16] Add 64x32 OLEDs (SH1107) --- src/components/i2c/WipperSnapper_I2C.cpp | 5 ++++- .../i2c/drivers/WipperSnapper_I2C_Driver_Out_Sh1107.h | 9 +++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/components/i2c/WipperSnapper_I2C.cpp b/src/components/i2c/WipperSnapper_I2C.cpp index cf8f27e28..ca1cf0217 100644 --- a/src/components/i2c/WipperSnapper_I2C.cpp +++ b/src/components/i2c/WipperSnapper_I2C.cpp @@ -902,7 +902,10 @@ bool WipperSnapper_Component_I2C::initI2CDevice( WS_DEBUG_PRINTLN("SH1107 display configured successfully!"); _drivers_out.push_back(_sh1107); WS_DEBUG_PRINTLN("SH1107 display initialized Successfully!"); - } else if (strcmp("oled128x32wingdefault", + } else if (strcmp("oled64x32default", msgDeviceInitReq->i2c_device_name) == + 0 || + strcmp("oled64x32large", msgDeviceInitReq->i2c_device_name) == 0 || + strcmp("oled128x32wingdefault", msgDeviceInitReq->i2c_device_name) == 0 || strcmp("oled128x32winglarge", msgDeviceInitReq->i2c_device_name) == 0 || diff --git a/src/components/i2c/drivers/WipperSnapper_I2C_Driver_Out_Sh1107.h b/src/components/i2c/drivers/WipperSnapper_I2C_Driver_Out_Sh1107.h index 172d4ca18..4b2b9537a 100644 --- a/src/components/i2c/drivers/WipperSnapper_I2C_Driver_Out_Sh1107.h +++ b/src/components/i2c/drivers/WipperSnapper_I2C_Driver_Out_Sh1107.h @@ -127,13 +127,11 @@ class WipperSnapper_I2C_Driver_Out_SH1107 @param text_size The magnification factor for the text size. */ - void ConfigureSSD1306(uint8_t width, uint8_t height, - uint8_t text_size) { + void ConfigureSSD1306(uint8_t width, uint8_t height, uint8_t text_size) { // This is a SH1107, not a SSD1306, so we don't need to do anything here. ConfigureSH1107(width, height, text_size); } - /*! @brief Writes a message to the SH1107 display. @param message @@ -189,11 +187,10 @@ class WipperSnapper_I2C_Driver_Out_SH1107 } } - /*! @brief Writes a message to the fake "SSD1306" SH1107 display. - @param msg_write - Pointer to a wippersnapper_i2c_v1_SSD1306Write message. + @param message + The message to be displayed. */ void WriteMessageSSD1306(const char *message) { // This is a SH1107, not a SSD1306, so we just call the SH1107 write From b93d58203d4121fb793476d7e6e995badecc3308 Mon Sep 17 00:00:00 2001 From: tyeth Date: Fri, 20 Jun 2025 19:20:16 +0100 Subject: [PATCH 04/16] Add 32x64 SSD1306 --- src/components/i2c/WipperSnapper_I2C.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/components/i2c/WipperSnapper_I2C.cpp b/src/components/i2c/WipperSnapper_I2C.cpp index ca1cf0217..1522a59d8 100644 --- a/src/components/i2c/WipperSnapper_I2C.cpp +++ b/src/components/i2c/WipperSnapper_I2C.cpp @@ -902,7 +902,8 @@ bool WipperSnapper_Component_I2C::initI2CDevice( WS_DEBUG_PRINTLN("SH1107 display configured successfully!"); _drivers_out.push_back(_sh1107); WS_DEBUG_PRINTLN("SH1107 display initialized Successfully!"); - } else if (strcmp("oled64x32default", msgDeviceInitReq->i2c_device_name) == + } else if (strcmp("oled32x64large", msgDeviceInitReq->i2c_device_name) == 0 || + strcmp("oled64x32default", msgDeviceInitReq->i2c_device_name) == 0 || strcmp("oled64x32large", msgDeviceInitReq->i2c_device_name) == 0 || strcmp("oled128x32wingdefault", From def13e627cc4135bc5c2663b7a8761f0b4215a3a Mon Sep 17 00:00:00 2001 From: tyeth Date: Mon, 23 Jun 2025 22:49:42 +0100 Subject: [PATCH 05/16] SSD1306: don't call begin again on i2c (2nd bus) --- .../i2c/drivers/WipperSnapper_I2C_Driver_Out_Ssd1306.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/i2c/drivers/WipperSnapper_I2C_Driver_Out_Ssd1306.h b/src/components/i2c/drivers/WipperSnapper_I2C_Driver_Out_Ssd1306.h index 6c8b25e7d..96921d64e 100644 --- a/src/components/i2c/drivers/WipperSnapper_I2C_Driver_Out_Ssd1306.h +++ b/src/components/i2c/drivers/WipperSnapper_I2C_Driver_Out_Ssd1306.h @@ -68,7 +68,7 @@ class WipperSnapper_I2C_Driver_Out_Ssd1306 bool begin() { // Attempt to create and allocate a SSD1306 obj. _display = new Adafruit_SSD1306(_width, _height, _i2c); - if (!_display->begin(SSD1306_SWITCHCAPVCC, _sensorAddress)) + if (!_display->begin(SSD1306_SWITCHCAPVCC, _sensorAddress, false, false)) return false; // Configure the text size and color _display->setTextSize(_text_sz); From d97123bf75e5160928afbcd14dfed109d0dbc78d Mon Sep 17 00:00:00 2001 From: tyeth Date: Tue, 24 Jun 2025 16:56:41 +0100 Subject: [PATCH 06/16] Set Rotation for 128x64 OLED featherwing --- .../drivers/WipperSnapper_I2C_Driver_Out_Sh1107.h | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/components/i2c/drivers/WipperSnapper_I2C_Driver_Out_Sh1107.h b/src/components/i2c/drivers/WipperSnapper_I2C_Driver_Out_Sh1107.h index 4b2b9537a..2d8c97228 100644 --- a/src/components/i2c/drivers/WipperSnapper_I2C_Driver_Out_Sh1107.h +++ b/src/components/i2c/drivers/WipperSnapper_I2C_Driver_Out_Sh1107.h @@ -68,8 +68,14 @@ class WipperSnapper_I2C_Driver_Out_SH1107 @returns True if initialized successfully, False otherwise. */ bool begin() { - // Attempt to create and allocate a SH1107 obj, backwards w/h - _display = new Adafruit_SH1107(_height, _width, _i2c); + uint8_t rotation = 0; // Default rotation + // Attempt to create and allocate a SH1107 obj + if (_width == 128 && _height == 64) { // featherwing + _display = new Adafruit_SH1107(_height, _width, _i2c); + rotation = 1; // Set rotation to 1 for 128x64 OLED featherwing + } else { + _display = new Adafruit_SH1107(_width, _height, _i2c); + } if (!_display->begin(_sensorAddress, true)) return false; @@ -82,7 +88,7 @@ class WipperSnapper_I2C_Driver_Out_SH1107 // Clear the buffer. _display->clearDisplay(); _display->display(); - _display->setRotation(1); + _display->setRotation(rotation); // Configure the text size and color _display->setTextSize(_text_sz); From d46f29c84aad8860664f29678bf4acfb9c69303f Mon Sep 17 00:00:00 2001 From: tyeth Date: Tue, 24 Jun 2025 19:21:07 +0100 Subject: [PATCH 07/16] Separate out rotation for future usage and add notes --- src/components/i2c/WipperSnapper_I2C.cpp | 7 ++++-- .../drivers/WipperSnapper_I2C_Driver_Out.h | 4 ++- .../WipperSnapper_I2C_Driver_Out_Sh1107.h | 25 +++++++++++-------- .../WipperSnapper_I2C_Driver_Out_Ssd1306.h | 22 ++++++++++------ 4 files changed, 37 insertions(+), 21 deletions(-) diff --git a/src/components/i2c/WipperSnapper_I2C.cpp b/src/components/i2c/WipperSnapper_I2C.cpp index 1522a59d8..9a58006a2 100644 --- a/src/components/i2c/WipperSnapper_I2C.cpp +++ b/src/components/i2c/WipperSnapper_I2C.cpp @@ -892,7 +892,9 @@ bool WipperSnapper_Component_I2C::initI2CDevice( (uint8_t)msgDeviceInitReq->i2c_output_add.config.ssd1306_config.width, (uint8_t)msgDeviceInitReq->i2c_output_add.config.ssd1306_config.height, (uint8_t) - msgDeviceInitReq->i2c_output_add.config.ssd1306_config.text_size); + msgDeviceInitReq->i2c_output_add.config.ssd1306_config.text_size, + 90); // fixed as currently the only screen is 128x64 featherwing which + // needs a rotation of 1 / 90degrees, and constructor w/h swap. if (!_sh1107->begin()) { WS_DEBUG_PRINTLN("ERROR: Failed to initialize sh1107!"); _busStatusResponse = @@ -925,7 +927,8 @@ bool WipperSnapper_Component_I2C::initI2CDevice( (uint8_t)msgDeviceInitReq->i2c_output_add.config.ssd1306_config.width, (uint8_t)msgDeviceInitReq->i2c_output_add.config.ssd1306_config.height, (uint8_t) - msgDeviceInitReq->i2c_output_add.config.ssd1306_config.text_size); + msgDeviceInitReq->i2c_output_add.config.ssd1306_config.text_size, + 0); // TODO: add rotation to protobuf and IO UI for adapted max len if (!_ssd1306->begin()) { WS_DEBUG_PRINTLN("ERROR: Failed to initialize ssd1306!"); _busStatusResponse = diff --git a/src/components/i2c/drivers/WipperSnapper_I2C_Driver_Out.h b/src/components/i2c/drivers/WipperSnapper_I2C_Driver_Out.h index e806a0dab..4e4091db3 100644 --- a/src/components/i2c/drivers/WipperSnapper_I2C_Driver_Out.h +++ b/src/components/i2c/drivers/WipperSnapper_I2C_Driver_Out.h @@ -62,9 +62,11 @@ class WipperSnapper_I2C_Driver_Out : public WipperSnapper_I2C_Driver { The height of the display in pixels. @param text_size The display's text size. + @param rotation + The rotation of the display in degrees, default is 0 (no rotation). */ virtual void ConfigureSSD1306(uint8_t width, uint8_t height, - uint8_t text_size) { + uint8_t text_size, uint8_t rotation = 0) { // noop } diff --git a/src/components/i2c/drivers/WipperSnapper_I2C_Driver_Out_Sh1107.h b/src/components/i2c/drivers/WipperSnapper_I2C_Driver_Out_Sh1107.h index 2d8c97228..f9e158072 100644 --- a/src/components/i2c/drivers/WipperSnapper_I2C_Driver_Out_Sh1107.h +++ b/src/components/i2c/drivers/WipperSnapper_I2C_Driver_Out_Sh1107.h @@ -68,11 +68,9 @@ class WipperSnapper_I2C_Driver_Out_SH1107 @returns True if initialized successfully, False otherwise. */ bool begin() { - uint8_t rotation = 0; // Default rotation - // Attempt to create and allocate a SH1107 obj - if (_width == 128 && _height == 64) { // featherwing + if (_width == 128 && _height == 64 && _rotation == 1) { + // featherwing needs to be rotated 90 degrees and swap w/h _display = new Adafruit_SH1107(_height, _width, _i2c); - rotation = 1; // Set rotation to 1 for 128x64 OLED featherwing } else { _display = new Adafruit_SH1107(_width, _height, _i2c); } @@ -88,7 +86,7 @@ class WipperSnapper_I2C_Driver_Out_SH1107 // Clear the buffer. _display->clearDisplay(); _display->display(); - _display->setRotation(rotation); + _display->setRotation(_rotation); // 0-3, not degrees for SH1107 // Configure the text size and color _display->setTextSize(_text_sz); @@ -115,11 +113,15 @@ class WipperSnapper_I2C_Driver_Out_SH1107 The height of the display in pixels. @param text_size The magnification factor for the text size. + @param rotation + The rotation of the display in degrees, default is 0 (no rotation). */ - void ConfigureSH1107(uint8_t width, uint8_t height, uint8_t text_size) { + void ConfigureSH1107(uint8_t width, uint8_t height, uint8_t text_size, + uint8_t rotation) { _width = width; _height = height; _text_sz = text_size; + _rotation = rotation % 90; WS_DEBUG_PRINT("SH1107 text size: "); WS_DEBUG_PRINTLN(text_size); } @@ -204,11 +206,12 @@ class WipperSnapper_I2C_Driver_Out_SH1107 } protected: - Adafruit_SH1107 *_display = - nullptr; ///< Pointer to the Adafruit_SH1107 object - uint8_t _width; ///< Width of the display in pixels - uint8_t _height; ///< Height of the display in pixels - uint8_t _text_sz; ///< Text size of the display + Adafruit_SH1107 *_display = + nullptr; ///< Pointer to the Adafruit_SH1107 object + uint8_t _width; ///< Width of the display in pixels + uint8_t _height; ///< Height of the display in pixels + uint8_t _rotation; ///< Rotation of the display (0-3) + uint8_t _text_sz; ///< Text size of the display }; #endif // WIPPERSNAPPER_I2C_DRIVER_OUT_SH1107_H diff --git a/src/components/i2c/drivers/WipperSnapper_I2C_Driver_Out_Ssd1306.h b/src/components/i2c/drivers/WipperSnapper_I2C_Driver_Out_Ssd1306.h index 96921d64e..584ae60c1 100644 --- a/src/components/i2c/drivers/WipperSnapper_I2C_Driver_Out_Ssd1306.h +++ b/src/components/i2c/drivers/WipperSnapper_I2C_Driver_Out_Ssd1306.h @@ -53,8 +53,10 @@ class WipperSnapper_I2C_Driver_Out_Ssd1306 */ ~WipperSnapper_I2C_Driver_Out_Ssd1306() { if (_display != nullptr) { + WS_DEBUG_PRINTLN("SSD1306 Destructor called, clearing display buffer."); _display->clearDisplay(); _display->display(); + WS_DEBUG_PRINTLN("SSD1306 display cleared, turning off display."); _display->ssd1306_command(SSD1306_DISPLAYOFF); delete _display; _display = nullptr; @@ -70,7 +72,8 @@ class WipperSnapper_I2C_Driver_Out_Ssd1306 _display = new Adafruit_SSD1306(_width, _height, _i2c); if (!_display->begin(SSD1306_SWITCHCAPVCC, _sensorAddress, false, false)) return false; - // Configure the text size and color + // Configure the rotation, text size and color + _display->setRotation(_rotation); _display->setTextSize(_text_sz); _display->setTextColor(SSD1306_WHITE); // Use full 256 char 'Code Page 437' font @@ -90,11 +93,15 @@ class WipperSnapper_I2C_Driver_Out_Ssd1306 The height of the display in pixels. @param text_size The magnification factor for the text size. + @param rotation + The rotation of the display in degrees, default is 0 (no rotation). */ - void ConfigureSSD1306(uint8_t width, uint8_t height, uint8_t text_size) { + void ConfigureSSD1306(uint8_t width, uint8_t height, uint8_t text_size, + uint8_t rotation = 0) { _width = width; _height = height; _text_sz = text_size; + _rotation = rotation; WS_DEBUG_PRINT("SSD1306 text size: "); WS_DEBUG_PRINTLN(text_size); } @@ -153,11 +160,12 @@ class WipperSnapper_I2C_Driver_Out_Ssd1306 } protected: - Adafruit_SSD1306 *_display = - nullptr; ///< Pointer to the Adafruit_SSD1306 object - uint8_t _width; ///< Width of the display in pixels - uint8_t _height; ///< Height of the display in pixels - uint8_t _text_sz; ///< Text size of the display + Adafruit_SSD1306 *_display = + nullptr; ///< Pointer to the Adafruit_SSD1306 object + uint8_t _width; ///< Width of the display in pixels + uint8_t _height; ///< Height of the display in pixels + uint8_t _rotation; ///< Rotation of the display in degrees + uint8_t _text_sz; ///< Text size of the display }; #endif // WIPPERSNAPPER_I2C_DRIVER_OUT_SSD1306_H \ No newline at end of file From 4b2859d6fb29d3c0a9d481056cd3989955f940d3 Mon Sep 17 00:00:00 2001 From: tyeth Date: Tue, 24 Jun 2025 20:48:58 +0100 Subject: [PATCH 08/16] add rotation to ConfigureSSD1306 func for SH1107 --- .../i2c/drivers/WipperSnapper_I2C_Driver_Out_Sh1107.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/components/i2c/drivers/WipperSnapper_I2C_Driver_Out_Sh1107.h b/src/components/i2c/drivers/WipperSnapper_I2C_Driver_Out_Sh1107.h index f9e158072..85a8de174 100644 --- a/src/components/i2c/drivers/WipperSnapper_I2C_Driver_Out_Sh1107.h +++ b/src/components/i2c/drivers/WipperSnapper_I2C_Driver_Out_Sh1107.h @@ -134,10 +134,13 @@ class WipperSnapper_I2C_Driver_Out_SH1107 The height of the display in pixels. @param text_size The magnification factor for the text size. + @param rotation + The rotation of the display in degrees, default is 0 (no rotation). */ - void ConfigureSSD1306(uint8_t width, uint8_t height, uint8_t text_size) { + void ConfigureSSD1306(uint8_t width, uint8_t height, uint8_t text_size, + uint8_t rotation = 0) { // This is a SH1107, not a SSD1306, so we don't need to do anything here. - ConfigureSH1107(width, height, text_size); + ConfigureSH1107(width, height, text_size, rotation); } /*! From 02223db340329637240bb5694a00ca62ce752209 Mon Sep 17 00:00:00 2001 From: tyeth Date: Tue, 24 Jun 2025 21:14:30 +0100 Subject: [PATCH 09/16] clang format --- src/components/i2c/WipperSnapper_I2C.cpp | 6 +++--- .../i2c/drivers/WipperSnapper_I2C_Driver_Out.h | 2 +- .../WipperSnapper_I2C_Driver_Out_Sh1107.h | 18 +++++++++--------- .../WipperSnapper_I2C_Driver_Out_Ssd1306.h | 16 ++++++++-------- 4 files changed, 21 insertions(+), 21 deletions(-) diff --git a/src/components/i2c/WipperSnapper_I2C.cpp b/src/components/i2c/WipperSnapper_I2C.cpp index 9a58006a2..bfbe7fd67 100644 --- a/src/components/i2c/WipperSnapper_I2C.cpp +++ b/src/components/i2c/WipperSnapper_I2C.cpp @@ -893,8 +893,8 @@ bool WipperSnapper_Component_I2C::initI2CDevice( (uint8_t)msgDeviceInitReq->i2c_output_add.config.ssd1306_config.height, (uint8_t) msgDeviceInitReq->i2c_output_add.config.ssd1306_config.text_size, - 90); // fixed as currently the only screen is 128x64 featherwing which - // needs a rotation of 1 / 90degrees, and constructor w/h swap. + 90); // fixed as currently the only screen is 128x64 featherwing which + // needs a rotation of 1 / 90degrees, and constructor w/h swap. if (!_sh1107->begin()) { WS_DEBUG_PRINTLN("ERROR: Failed to initialize sh1107!"); _busStatusResponse = @@ -928,7 +928,7 @@ bool WipperSnapper_Component_I2C::initI2CDevice( (uint8_t)msgDeviceInitReq->i2c_output_add.config.ssd1306_config.height, (uint8_t) msgDeviceInitReq->i2c_output_add.config.ssd1306_config.text_size, - 0); // TODO: add rotation to protobuf and IO UI for adapted max len + 0); // TODO: add rotation to protobuf and IO UI for adapted max len if (!_ssd1306->begin()) { WS_DEBUG_PRINTLN("ERROR: Failed to initialize ssd1306!"); _busStatusResponse = diff --git a/src/components/i2c/drivers/WipperSnapper_I2C_Driver_Out.h b/src/components/i2c/drivers/WipperSnapper_I2C_Driver_Out.h index 4e4091db3..c92debec7 100644 --- a/src/components/i2c/drivers/WipperSnapper_I2C_Driver_Out.h +++ b/src/components/i2c/drivers/WipperSnapper_I2C_Driver_Out.h @@ -63,7 +63,7 @@ class WipperSnapper_I2C_Driver_Out : public WipperSnapper_I2C_Driver { @param text_size The display's text size. @param rotation - The rotation of the display in degrees, default is 0 (no rotation). + The rotation of the display in degrees, default is 0. */ virtual void ConfigureSSD1306(uint8_t width, uint8_t height, uint8_t text_size, uint8_t rotation = 0) { diff --git a/src/components/i2c/drivers/WipperSnapper_I2C_Driver_Out_Sh1107.h b/src/components/i2c/drivers/WipperSnapper_I2C_Driver_Out_Sh1107.h index 85a8de174..719689adc 100644 --- a/src/components/i2c/drivers/WipperSnapper_I2C_Driver_Out_Sh1107.h +++ b/src/components/i2c/drivers/WipperSnapper_I2C_Driver_Out_Sh1107.h @@ -86,7 +86,7 @@ class WipperSnapper_I2C_Driver_Out_SH1107 // Clear the buffer. _display->clearDisplay(); _display->display(); - _display->setRotation(_rotation); // 0-3, not degrees for SH1107 + _display->setRotation(_rotation); // 0-3, not degrees for SH1107 // Configure the text size and color _display->setTextSize(_text_sz); @@ -114,7 +114,7 @@ class WipperSnapper_I2C_Driver_Out_SH1107 @param text_size The magnification factor for the text size. @param rotation - The rotation of the display in degrees, default is 0 (no rotation). + The rotation of the display in degrees, default is 0. */ void ConfigureSH1107(uint8_t width, uint8_t height, uint8_t text_size, uint8_t rotation) { @@ -135,7 +135,7 @@ class WipperSnapper_I2C_Driver_Out_SH1107 @param text_size The magnification factor for the text size. @param rotation - The rotation of the display in degrees, default is 0 (no rotation). + The rotation of the display in degrees, default is 0. */ void ConfigureSSD1306(uint8_t width, uint8_t height, uint8_t text_size, uint8_t rotation = 0) { @@ -209,12 +209,12 @@ class WipperSnapper_I2C_Driver_Out_SH1107 } protected: - Adafruit_SH1107 *_display = - nullptr; ///< Pointer to the Adafruit_SH1107 object - uint8_t _width; ///< Width of the display in pixels - uint8_t _height; ///< Height of the display in pixels - uint8_t _rotation; ///< Rotation of the display (0-3) - uint8_t _text_sz; ///< Text size of the display + Adafruit_SH1107 *_display = + nullptr; ///< Pointer to the Adafruit_SH1107 object + uint8_t _width; ///< Width of the display in pixels + uint8_t _height; ///< Height of the display in pixels + uint8_t _rotation; ///< Rotation of the display (0-3) + uint8_t _text_sz; ///< Text size of the display }; #endif // WIPPERSNAPPER_I2C_DRIVER_OUT_SH1107_H diff --git a/src/components/i2c/drivers/WipperSnapper_I2C_Driver_Out_Ssd1306.h b/src/components/i2c/drivers/WipperSnapper_I2C_Driver_Out_Ssd1306.h index 584ae60c1..6ca6cb38b 100644 --- a/src/components/i2c/drivers/WipperSnapper_I2C_Driver_Out_Ssd1306.h +++ b/src/components/i2c/drivers/WipperSnapper_I2C_Driver_Out_Ssd1306.h @@ -94,9 +94,9 @@ class WipperSnapper_I2C_Driver_Out_Ssd1306 @param text_size The magnification factor for the text size. @param rotation - The rotation of the display in degrees, default is 0 (no rotation). + The rotation of the display in degrees, default is 0. */ - void ConfigureSSD1306(uint8_t width, uint8_t height, uint8_t text_size, + void ConfigureSSD1306(uint8_t width, uint8_t height, uint8_t text_size, uint8_t rotation = 0) { _width = width; _height = height; @@ -160,12 +160,12 @@ class WipperSnapper_I2C_Driver_Out_Ssd1306 } protected: - Adafruit_SSD1306 *_display = - nullptr; ///< Pointer to the Adafruit_SSD1306 object - uint8_t _width; ///< Width of the display in pixels - uint8_t _height; ///< Height of the display in pixels - uint8_t _rotation; ///< Rotation of the display in degrees - uint8_t _text_sz; ///< Text size of the display + Adafruit_SSD1306 *_display = + nullptr; ///< Pointer to the Adafruit_SSD1306 object + uint8_t _width; ///< Width of the display in pixels + uint8_t _height; ///< Height of the display in pixels + uint8_t _rotation; ///< Rotation of the display in degrees + uint8_t _text_sz; ///< Text size of the display }; #endif // WIPPERSNAPPER_I2C_DRIVER_OUT_SSD1306_H \ No newline at end of file From 651395638df5410e0c93da96fc75d6a1a9e008d6 Mon Sep 17 00:00:00 2001 From: Tyeth Gundry Date: Wed, 9 Jul 2025 15:12:43 +0100 Subject: [PATCH 10/16] PR Feedback --- src/components/i2c/WipperSnapper_I2C.cpp | 18 ++++----- .../WipperSnapper_I2C_Driver_Out_Sh1107.h | 39 +++++++------------ .../WipperSnapper_I2C_Driver_Out_Ssd1306.h | 15 ++----- 3 files changed, 27 insertions(+), 45 deletions(-) diff --git a/src/components/i2c/WipperSnapper_I2C.cpp b/src/components/i2c/WipperSnapper_I2C.cpp index bfbe7fd67..389a4f34e 100644 --- a/src/components/i2c/WipperSnapper_I2C.cpp +++ b/src/components/i2c/WipperSnapper_I2C.cpp @@ -881,9 +881,8 @@ bool WipperSnapper_Component_I2C::initI2CDevice( } _drivers_out.push_back(_sevenSeg); WS_DEBUG_PRINTLN("7-Segement LED Matrix Initialized Successfully!"); - } else if (strcmp("oled128x64wingdefault", - msgDeviceInitReq->i2c_device_name) == 0 || - strcmp("oled128x64winglarge", msgDeviceInitReq->i2c_device_name) == + } else if (strcmp("oled128x64wdefault", msgDeviceInitReq->i2c_device_name) == 0 || + strcmp("oled128x64wlarge", msgDeviceInitReq->i2c_device_name) == 0) { WS_DEBUG_PRINTLN("SH1107 display detected!"); _sh1107 = new WipperSnapper_I2C_Driver_Out_SH1107(this->_i2c, i2cAddress); @@ -893,8 +892,8 @@ bool WipperSnapper_Component_I2C::initI2CDevice( (uint8_t)msgDeviceInitReq->i2c_output_add.config.ssd1306_config.height, (uint8_t) msgDeviceInitReq->i2c_output_add.config.ssd1306_config.text_size, - 90); // fixed as currently the only screen is 128x64 featherwing which - // needs a rotation of 1 / 90degrees, and constructor w/h swap. + OLED_128X64_WING_ROTATION_90); // fixed as currently the only screen is + // 128x64wing (needs a rotation of 1 / 90degrees and constructor w/h swap). if (!_sh1107->begin()) { WS_DEBUG_PRINTLN("ERROR: Failed to initialize sh1107!"); _busStatusResponse = @@ -908,9 +907,9 @@ bool WipperSnapper_Component_I2C::initI2CDevice( strcmp("oled64x32default", msgDeviceInitReq->i2c_device_name) == 0 || strcmp("oled64x32large", msgDeviceInitReq->i2c_device_name) == 0 || - strcmp("oled128x32wingdefault", - msgDeviceInitReq->i2c_device_name) == 0 || - strcmp("oled128x32winglarge", msgDeviceInitReq->i2c_device_name) == + strcmp("oled128x32wdefault", msgDeviceInitReq->i2c_device_name) == + 0 || + strcmp("oled128x32wlarge", msgDeviceInitReq->i2c_device_name) == 0 || strcmp("oled128x32default", msgDeviceInitReq->i2c_device_name) == 0 || @@ -927,8 +926,7 @@ bool WipperSnapper_Component_I2C::initI2CDevice( (uint8_t)msgDeviceInitReq->i2c_output_add.config.ssd1306_config.width, (uint8_t)msgDeviceInitReq->i2c_output_add.config.ssd1306_config.height, (uint8_t) - msgDeviceInitReq->i2c_output_add.config.ssd1306_config.text_size, - 0); // TODO: add rotation to protobuf and IO UI for adapted max len + msgDeviceInitReq->i2c_output_add.config.ssd1306_config.text_size); if (!_ssd1306->begin()) { WS_DEBUG_PRINTLN("ERROR: Failed to initialize ssd1306!"); _busStatusResponse = diff --git a/src/components/i2c/drivers/WipperSnapper_I2C_Driver_Out_Sh1107.h b/src/components/i2c/drivers/WipperSnapper_I2C_Driver_Out_Sh1107.h index 719689adc..85afe4458 100644 --- a/src/components/i2c/drivers/WipperSnapper_I2C_Driver_Out_Sh1107.h +++ b/src/components/i2c/drivers/WipperSnapper_I2C_Driver_Out_Sh1107.h @@ -7,7 +7,7 @@ * please support Adafruit and open-source hardware by purchasing * products from Adafruit! * - * Copyright (c) Brent Rubell for Adafruit Industries 2025 + * Copyright (c) Tyeth Gundry for Adafruit Industries 2025 * * MIT license, all text here must be included in any redistribution. * @@ -17,13 +17,16 @@ #define WIPPERSNAPPER_I2C_DRIVER_OUT_SH1107_H #include "WipperSnapper_I2C_Driver_Out.h" -// #include #include #include #include -#define DEFAULT_WIDTH 128 ///< Default width for a sh1107 128x64 display -#define DEFAULT_HEIGHT 64 ///< Default height for a sh1107 128x64 display +#define WS_SH1107_DEFAULT_WIDTH 128 ///< Default width for a sh1107 128x64 display +#define WS_SH1107_DEFAULT_HEIGHT 64 ///< Default height for a sh1107 128x64 display + +#define OLED_128X64_WING_WIDTH 128 ///< Width of the 128x64 OLED FeatherWing +#define OLED_128X64_WING_HEIGHT 64 ///< Height of the 128x64 OLED FeatherWing +#define OLED_128X64_WING_ROTATION_90 1 ///< Rotation of OLED FeatherWing 0-3 /*! @brief Class that provides a driver interface for a SH1107 @@ -35,7 +38,7 @@ class WipperSnapper_I2C_Driver_Out_SH1107 public: /*******************************************************************************/ /*! - @brief Constructor for a OLED display. + @brief Constructor for an SH1107 OLED display. @param i2c The I2C interface. @param sensorAddress @@ -46,8 +49,8 @@ class WipperSnapper_I2C_Driver_Out_SH1107 : WipperSnapper_I2C_Driver_Out(i2c, sensorAddress) { _i2c = i2c; _sensorAddress = sensorAddress; - _width = DEFAULT_WIDTH; - _height = DEFAULT_HEIGHT; + _width = WS_SH1107_DEFAULT_WIDTH; + _height = WS_SH1107_DEFAULT_HEIGHT; } /*! @@ -68,8 +71,10 @@ class WipperSnapper_I2C_Driver_Out_SH1107 @returns True if initialized successfully, False otherwise. */ bool begin() { - if (_width == 128 && _height == 64 && _rotation == 1) { - // featherwing needs to be rotated 90 degrees and swap w/h + if (_width == OLED_128X64_WING_WIDTH && + _height == OLED_128X64_WING_HEIGHT && + _rotation == OLED_128X64_WING_ROTATION_90) { + // featherwing needs to be rotated 90 degrees and swap w/h ctor args _display = new Adafruit_SH1107(_height, _width, _i2c); } else { _display = new Adafruit_SH1107(_width, _height, _i2c); @@ -92,15 +97,9 @@ class WipperSnapper_I2C_Driver_Out_SH1107 _display->setTextSize(_text_sz); _display->setTextColor(SH110X_WHITE); _display->setCursor(0, 0); - // Use full 256 char 'Code Page 437' font - // _display->cp437(true); // Clear the buffer _display->clearDisplay(); _display->display(); - _display->print(char('a')); - delay(500); - _display->write(char('b')); - _display->display(); return true; } @@ -121,9 +120,7 @@ class WipperSnapper_I2C_Driver_Out_SH1107 _width = width; _height = height; _text_sz = text_size; - _rotation = rotation % 90; - WS_DEBUG_PRINT("SH1107 text size: "); - WS_DEBUG_PRINTLN(text_size); + _rotation = rotation % 90; // SH1107 requires rotation to be 0-3, not degrees } /*! @brief Configures a SSD1306 OLED display. Must be called before driver @@ -151,8 +148,6 @@ class WipperSnapper_I2C_Driver_Out_SH1107 void WriteMessageSH1107(const char *message) { if (_display == nullptr) return; - WS_DEBUG_PRINT("SH1107 Message:"); - WS_DEBUG_PRINTLN(message); // Start with a fresh display buffer // and settings int16_t y_idx = 0; @@ -175,15 +170,11 @@ class WipperSnapper_I2C_Driver_Out_SH1107 message[i + 2] == '\\' && message[i + 3] == 'n') { // Skip to the next line y_idx += line_height; - WS_DEBUG_PRINT("SH1107 Newline at: "); - WS_DEBUG_PRINTLN(y_idx); _display->setCursor(0, y_idx); i += 3; } else if (message[i + 1] == 'n') { // Skip to the next line y_idx += line_height; - WS_DEBUG_PRINT("SH1107 Newline at: "); - WS_DEBUG_PRINTLN(y_idx); _display->setCursor(0, y_idx); i++; } diff --git a/src/components/i2c/drivers/WipperSnapper_I2C_Driver_Out_Ssd1306.h b/src/components/i2c/drivers/WipperSnapper_I2C_Driver_Out_Ssd1306.h index 6ca6cb38b..202689b77 100644 --- a/src/components/i2c/drivers/WipperSnapper_I2C_Driver_Out_Ssd1306.h +++ b/src/components/i2c/drivers/WipperSnapper_I2C_Driver_Out_Ssd1306.h @@ -20,8 +20,8 @@ #include #include -#define DEFAULT_WIDTH 128 ///< Default width for a ssd1306 128x64 display -#define DEFAULT_HEIGHT 64 ///< Default height for a ssd1306 128x64 display +#define WS_SSD1306_DEFAULT_WIDTH 128 ///< Default width for a ssd1306 128x64 display +#define WS_SSD1306_DEFAULT_HEIGHT 64 ///< Default height for a ssd1306 128x64 display /*! @brief Class that provides a driver interface for a SSD1306 @@ -44,8 +44,8 @@ class WipperSnapper_I2C_Driver_Out_Ssd1306 : WipperSnapper_I2C_Driver_Out(i2c, sensorAddress) { _i2c = i2c; _sensorAddress = sensorAddress; - _width = DEFAULT_WIDTH; - _height = DEFAULT_HEIGHT; + _width = WS_SSD1306_DEFAULT_WIDTH; + _height = WS_SSD1306_DEFAULT_HEIGHT; } /*! @@ -53,10 +53,8 @@ class WipperSnapper_I2C_Driver_Out_Ssd1306 */ ~WipperSnapper_I2C_Driver_Out_Ssd1306() { if (_display != nullptr) { - WS_DEBUG_PRINTLN("SSD1306 Destructor called, clearing display buffer."); _display->clearDisplay(); _display->display(); - WS_DEBUG_PRINTLN("SSD1306 display cleared, turning off display."); _display->ssd1306_command(SSD1306_DISPLAYOFF); delete _display; _display = nullptr; @@ -102,8 +100,6 @@ class WipperSnapper_I2C_Driver_Out_Ssd1306 _height = height; _text_sz = text_size; _rotation = rotation; - WS_DEBUG_PRINT("SSD1306 text size: "); - WS_DEBUG_PRINTLN(text_size); } /*! @@ -115,9 +111,6 @@ class WipperSnapper_I2C_Driver_Out_Ssd1306 if (_display == nullptr) return; - WS_DEBUG_PRINT("SSD1306 Message:"); - WS_DEBUG_PRINTLN(message); - // Start with a fresh display buffer // and settings int16_t y_idx = 0; From e632bc6373c96648861a4d2abc6e1bfe042c8c73 Mon Sep 17 00:00:00 2001 From: Tyeth Gundry Date: Wed, 9 Jul 2025 17:00:25 +0100 Subject: [PATCH 11/16] clang format --- src/components/i2c/WipperSnapper_I2C.cpp | 5 +++-- .../i2c/drivers/WipperSnapper_I2C_Driver_Out_Sh1107.h | 8 +++++--- .../i2c/drivers/WipperSnapper_I2C_Driver_Out_Ssd1306.h | 6 ++++-- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/src/components/i2c/WipperSnapper_I2C.cpp b/src/components/i2c/WipperSnapper_I2C.cpp index 389a4f34e..115fce983 100644 --- a/src/components/i2c/WipperSnapper_I2C.cpp +++ b/src/components/i2c/WipperSnapper_I2C.cpp @@ -881,7 +881,8 @@ bool WipperSnapper_Component_I2C::initI2CDevice( } _drivers_out.push_back(_sevenSeg); WS_DEBUG_PRINTLN("7-Segement LED Matrix Initialized Successfully!"); - } else if (strcmp("oled128x64wdefault", msgDeviceInitReq->i2c_device_name) == 0 || + } else if (strcmp("oled128x64wdefault", msgDeviceInitReq->i2c_device_name) == + 0 || strcmp("oled128x64wlarge", msgDeviceInitReq->i2c_device_name) == 0) { WS_DEBUG_PRINTLN("SH1107 display detected!"); @@ -892,7 +893,7 @@ bool WipperSnapper_Component_I2C::initI2CDevice( (uint8_t)msgDeviceInitReq->i2c_output_add.config.ssd1306_config.height, (uint8_t) msgDeviceInitReq->i2c_output_add.config.ssd1306_config.text_size, - OLED_128X64_WING_ROTATION_90); // fixed as currently the only screen is + OLED_128X64_WING_ROTATION_90); // fixed as currently the only screen is // 128x64wing (needs a rotation of 1 / 90degrees and constructor w/h swap). if (!_sh1107->begin()) { WS_DEBUG_PRINTLN("ERROR: Failed to initialize sh1107!"); diff --git a/src/components/i2c/drivers/WipperSnapper_I2C_Driver_Out_Sh1107.h b/src/components/i2c/drivers/WipperSnapper_I2C_Driver_Out_Sh1107.h index 85afe4458..cab8af801 100644 --- a/src/components/i2c/drivers/WipperSnapper_I2C_Driver_Out_Sh1107.h +++ b/src/components/i2c/drivers/WipperSnapper_I2C_Driver_Out_Sh1107.h @@ -21,8 +21,10 @@ #include #include -#define WS_SH1107_DEFAULT_WIDTH 128 ///< Default width for a sh1107 128x64 display -#define WS_SH1107_DEFAULT_HEIGHT 64 ///< Default height for a sh1107 128x64 display +#define WS_SH1107_DEFAULT_WIDTH \ + 128 ///< Default width for a sh1107 128x64 display +#define WS_SH1107_DEFAULT_HEIGHT \ + 64 ///< Default height for a sh1107 128x64 display #define OLED_128X64_WING_WIDTH 128 ///< Width of the 128x64 OLED FeatherWing #define OLED_128X64_WING_HEIGHT 64 ///< Height of the 128x64 OLED FeatherWing @@ -135,7 +137,7 @@ class WipperSnapper_I2C_Driver_Out_SH1107 The rotation of the display in degrees, default is 0. */ void ConfigureSSD1306(uint8_t width, uint8_t height, uint8_t text_size, - uint8_t rotation = 0) { + uint8_t rotation) { // This is a SH1107, not a SSD1306, so we don't need to do anything here. ConfigureSH1107(width, height, text_size, rotation); } diff --git a/src/components/i2c/drivers/WipperSnapper_I2C_Driver_Out_Ssd1306.h b/src/components/i2c/drivers/WipperSnapper_I2C_Driver_Out_Ssd1306.h index 202689b77..20cde207d 100644 --- a/src/components/i2c/drivers/WipperSnapper_I2C_Driver_Out_Ssd1306.h +++ b/src/components/i2c/drivers/WipperSnapper_I2C_Driver_Out_Ssd1306.h @@ -20,8 +20,10 @@ #include #include -#define WS_SSD1306_DEFAULT_WIDTH 128 ///< Default width for a ssd1306 128x64 display -#define WS_SSD1306_DEFAULT_HEIGHT 64 ///< Default height for a ssd1306 128x64 display +#define WS_SSD1306_DEFAULT_WIDTH \ + 128 ///< Default width for a ssd1306 128x64 display +#define WS_SSD1306_DEFAULT_HEIGHT \ + 64 ///< Default height for a ssd1306 128x64 display /*! @brief Class that provides a driver interface for a SSD1306 From 09c8eb03871e1f817d248b0a4304d1215d4c6f88 Mon Sep 17 00:00:00 2001 From: Tyeth Gundry Date: Wed, 9 Jul 2025 17:08:41 +0100 Subject: [PATCH 12/16] Remove splash screen display + delay --- .../i2c/drivers/WipperSnapper_I2C_Driver_Out_Sh1107.h | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/components/i2c/drivers/WipperSnapper_I2C_Driver_Out_Sh1107.h b/src/components/i2c/drivers/WipperSnapper_I2C_Driver_Out_Sh1107.h index cab8af801..d3ebd4962 100644 --- a/src/components/i2c/drivers/WipperSnapper_I2C_Driver_Out_Sh1107.h +++ b/src/components/i2c/drivers/WipperSnapper_I2C_Driver_Out_Sh1107.h @@ -84,11 +84,6 @@ class WipperSnapper_I2C_Driver_Out_SH1107 if (!_display->begin(_sensorAddress, true)) return false; - // Show image buffer on the display hardware. - // Since the buffer is intialized with an Adafruit splashscreen - // internally, this will display the splashscreen. - _display->display(); - delay(1700); // Clear the buffer. _display->clearDisplay(); From 0c55b0320db4f15fdc68892d79d600dd0de7e714 Mon Sep 17 00:00:00 2001 From: Tyeth Gundry Date: Wed, 9 Jul 2025 17:11:04 +0100 Subject: [PATCH 13/16] Rename OLED featherwings --- src/components/i2c/WipperSnapper_I2C.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/components/i2c/WipperSnapper_I2C.cpp b/src/components/i2c/WipperSnapper_I2C.cpp index 115fce983..d06cf7057 100644 --- a/src/components/i2c/WipperSnapper_I2C.cpp +++ b/src/components/i2c/WipperSnapper_I2C.cpp @@ -881,9 +881,9 @@ bool WipperSnapper_Component_I2C::initI2CDevice( } _drivers_out.push_back(_sevenSeg); WS_DEBUG_PRINTLN("7-Segement LED Matrix Initialized Successfully!"); - } else if (strcmp("oled128x64wdefault", msgDeviceInitReq->i2c_device_name) == + } else if (strcmp("fthrwingoled128x64", msgDeviceInitReq->i2c_device_name) == 0 || - strcmp("oled128x64wlarge", msgDeviceInitReq->i2c_device_name) == + strcmp("fthrwingoled128x64lg", msgDeviceInitReq->i2c_device_name) == 0) { WS_DEBUG_PRINTLN("SH1107 display detected!"); _sh1107 = new WipperSnapper_I2C_Driver_Out_SH1107(this->_i2c, i2cAddress); @@ -908,10 +908,10 @@ bool WipperSnapper_Component_I2C::initI2CDevice( strcmp("oled64x32default", msgDeviceInitReq->i2c_device_name) == 0 || strcmp("oled64x32large", msgDeviceInitReq->i2c_device_name) == 0 || - strcmp("oled128x32wdefault", msgDeviceInitReq->i2c_device_name) == - 0 || - strcmp("oled128x32wlarge", msgDeviceInitReq->i2c_device_name) == + strcmp("fthrwingoled128x32", msgDeviceInitReq->i2c_device_name) == 0 || + strcmp("fthrwingoled128x32lg", + msgDeviceInitReq->i2c_device_name) == 0 || strcmp("oled128x32default", msgDeviceInitReq->i2c_device_name) == 0 || strcmp("oled128x32large", msgDeviceInitReq->i2c_device_name) == From e0d9da4d47fd772df1a2b424d22a5aeca45d497d Mon Sep 17 00:00:00 2001 From: Tyeth Gundry Date: Wed, 9 Jul 2025 17:13:01 +0100 Subject: [PATCH 14/16] Remove non default args to SSD1306 ctor --- .../i2c/drivers/WipperSnapper_I2C_Driver_Out_Ssd1306.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/i2c/drivers/WipperSnapper_I2C_Driver_Out_Ssd1306.h b/src/components/i2c/drivers/WipperSnapper_I2C_Driver_Out_Ssd1306.h index 20cde207d..374b826a1 100644 --- a/src/components/i2c/drivers/WipperSnapper_I2C_Driver_Out_Ssd1306.h +++ b/src/components/i2c/drivers/WipperSnapper_I2C_Driver_Out_Ssd1306.h @@ -70,7 +70,7 @@ class WipperSnapper_I2C_Driver_Out_Ssd1306 bool begin() { // Attempt to create and allocate a SSD1306 obj. _display = new Adafruit_SSD1306(_width, _height, _i2c); - if (!_display->begin(SSD1306_SWITCHCAPVCC, _sensorAddress, false, false)) + if (!_display->begin(SSD1306_SWITCHCAPVCC, _sensorAddress)) return false; // Configure the rotation, text size and color _display->setRotation(_rotation); From 1e313842b63868f7b4f3613299915ceddc2c179f Mon Sep 17 00:00:00 2001 From: Tyeth Gundry Date: Wed, 9 Jul 2025 17:27:52 +0100 Subject: [PATCH 15/16] clang format again --- src/components/i2c/WipperSnapper_I2C.cpp | 4 ++-- .../WipperSnapper_I2C_Driver_Out_Sh1107.h | 18 +++++++++--------- .../WipperSnapper_I2C_Driver_Out_Ssd1306.h | 8 ++++---- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/components/i2c/WipperSnapper_I2C.cpp b/src/components/i2c/WipperSnapper_I2C.cpp index d06cf7057..556040d47 100644 --- a/src/components/i2c/WipperSnapper_I2C.cpp +++ b/src/components/i2c/WipperSnapper_I2C.cpp @@ -883,8 +883,8 @@ bool WipperSnapper_Component_I2C::initI2CDevice( WS_DEBUG_PRINTLN("7-Segement LED Matrix Initialized Successfully!"); } else if (strcmp("fthrwingoled128x64", msgDeviceInitReq->i2c_device_name) == 0 || - strcmp("fthrwingoled128x64lg", msgDeviceInitReq->i2c_device_name) == - 0) { + strcmp("fthrwingoled128x64lg", + msgDeviceInitReq->i2c_device_name) == 0) { WS_DEBUG_PRINTLN("SH1107 display detected!"); _sh1107 = new WipperSnapper_I2C_Driver_Out_SH1107(this->_i2c, i2cAddress); WS_DEBUG_PRINTLN("Configuring SH1107 display..."); diff --git a/src/components/i2c/drivers/WipperSnapper_I2C_Driver_Out_Sh1107.h b/src/components/i2c/drivers/WipperSnapper_I2C_Driver_Out_Sh1107.h index d3ebd4962..1ef27e450 100644 --- a/src/components/i2c/drivers/WipperSnapper_I2C_Driver_Out_Sh1107.h +++ b/src/components/i2c/drivers/WipperSnapper_I2C_Driver_Out_Sh1107.h @@ -21,14 +21,14 @@ #include #include -#define WS_SH1107_DEFAULT_WIDTH \ - 128 ///< Default width for a sh1107 128x64 display -#define WS_SH1107_DEFAULT_HEIGHT \ - 64 ///< Default height for a sh1107 128x64 display +#define WS_SH1107_DEFAULT_WIDTH \ + 128 ///< Default width for a sh1107 128x64 display +#define WS_SH1107_DEFAULT_HEIGHT \ + 64 ///< Default height for a sh1107 128x64 display -#define OLED_128X64_WING_WIDTH 128 ///< Width of the 128x64 OLED FeatherWing -#define OLED_128X64_WING_HEIGHT 64 ///< Height of the 128x64 OLED FeatherWing -#define OLED_128X64_WING_ROTATION_90 1 ///< Rotation of OLED FeatherWing 0-3 +#define OLED_128X64_WING_WIDTH 128 ///< Width of the 128x64 OLED FeatherWing +#define OLED_128X64_WING_HEIGHT 64 ///< Height of the 128x64 OLED FeatherWing +#define OLED_128X64_WING_ROTATION_90 1 ///< Rotation of OLED FeatherWing 0-3 /*! @brief Class that provides a driver interface for a SH1107 @@ -84,7 +84,6 @@ class WipperSnapper_I2C_Driver_Out_SH1107 if (!_display->begin(_sensorAddress, true)) return false; - // Clear the buffer. _display->clearDisplay(); _display->display(); @@ -117,7 +116,8 @@ class WipperSnapper_I2C_Driver_Out_SH1107 _width = width; _height = height; _text_sz = text_size; - _rotation = rotation % 90; // SH1107 requires rotation to be 0-3, not degrees + _rotation = + rotation % 90; // SH1107 requires rotation to be 0-3, not degrees } /*! @brief Configures a SSD1306 OLED display. Must be called before driver diff --git a/src/components/i2c/drivers/WipperSnapper_I2C_Driver_Out_Ssd1306.h b/src/components/i2c/drivers/WipperSnapper_I2C_Driver_Out_Ssd1306.h index 374b826a1..454a5852f 100644 --- a/src/components/i2c/drivers/WipperSnapper_I2C_Driver_Out_Ssd1306.h +++ b/src/components/i2c/drivers/WipperSnapper_I2C_Driver_Out_Ssd1306.h @@ -20,10 +20,10 @@ #include #include -#define WS_SSD1306_DEFAULT_WIDTH \ - 128 ///< Default width for a ssd1306 128x64 display -#define WS_SSD1306_DEFAULT_HEIGHT \ - 64 ///< Default height for a ssd1306 128x64 display +#define WS_SSD1306_DEFAULT_WIDTH \ + 128 ///< Default width for a ssd1306 128x64 display +#define WS_SSD1306_DEFAULT_HEIGHT \ + 64 ///< Default height for a ssd1306 128x64 display /*! @brief Class that provides a driver interface for a SSD1306 From c3bc7a83d66c9d9cc2218572bfdbf92d0ad2659a Mon Sep 17 00:00:00 2001 From: Tyeth Gundry Date: Wed, 9 Jul 2025 20:36:55 +0100 Subject: [PATCH 16/16] Release version 1.0.0-beta.104 --- library.properties | 2 +- src/Wippersnapper.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/library.properties b/library.properties index d227d9c7e..f1c5af030 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=Adafruit WipperSnapper -version=1.0.0-beta.103 +version=1.0.0-beta.104 author=Adafruit maintainer=Adafruit sentence=Arduino application for Adafruit.io WipperSnapper diff --git a/src/Wippersnapper.h b/src/Wippersnapper.h index 0ad167d74..f7fde4f98 100644 --- a/src/Wippersnapper.h +++ b/src/Wippersnapper.h @@ -142,7 +142,7 @@ #endif #define WS_VERSION \ - "1.0.0-beta.103" ///< WipperSnapper app. version (semver-formatted) + "1.0.0-beta.104" ///< WipperSnapper app. version (semver-formatted) // Reserved Adafruit IO MQTT topics #define TOPIC_IO_THROTTLE "/throttle" ///< Adafruit IO Throttle MQTT Topic