meshtastic / firmware

Meshtastic device firmware
https://meshtastic.org
GNU General Public License v3.0
3.23k stars 780 forks source link

[Bug]: Cannot rotate screen on SH1107 #3236

Closed andyshinn closed 5 months ago

andyshinn commented 6 months ago

Category

Hardware Compatibility

Hardware

Other

Firmware Version

2.2.23.e3c4bc54

Description

I am trying to build a DIY device using RFM and SH1107 OLED screen. I have the firmware compiling. But the screen rotation doesn't appear to be correct.

IMG_1310

My variant.h config is:

#define I2C_SDA 23
#define I2C_SCL 22

#undef GPS_RX_PIN
#define GPS_RX_PIN 15

#define BUTTON_PIN 32

#define LORA_DIO0 26
#define LORA_RESET 27
#define LORA_DIO1 33
#define LORA_DIO2 32
#define LORA_DIO3

#define LORA_RXEN 14
#define LORA_TXEN 13

#undef LORA_SCK
#define LORA_SCK 18
#undef LORA_MISO
#define LORA_MISO 19
#undef LORA_MOSI
#define LORA_MOSI 23
#undef LORA_CS
#define LORA_CS 5

// RX/TX for RFM95/SX127x
#define RF95_RXEN LORA_RXEN
#define RF95_TXEN LORA_TXEN
// #define RF95_TCXO <GPIO#>

#define SX126X_CS 5
#define SX126X_DIO1 LORA_DIO1
#define SX126X_BUSY LORA_DIO2
#define SX126X_RESET LORA_RESET
#define SX126X_RXEN LORA_RXEN
#define SX126X_TXEN LORA_TXEN

// supported modules list
// #define USE_RF95 // RFM95/SX127x
// #define USE_SX1262
// #define USE_SX1268
// #define USE_LLCC68
#define USE_SH1107_128_64

And my platformio.ini:

; Custom Adafruit HUZZAH32
[env:huzzah]
extends = esp32_base
board = featheresp32
board_level = extra
build_flags =
  ${esp32_base.build_flags}
  -D PRIVATE_HW
  -I variants/diy/huzzah

I have also tried to define SCREEN_ROTATE but it doesn't seem to have any effect. Is there a way to rotate the screen on the SH1107?

Relevant log output

rst:0x1 (POWERON_RESET),boot:0x17 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0030,len:1184
load:0x40078000,len:13220
ho 0 tail 12 room 4
load:0x40080400,len:3028
entry 0x400805e4
E (682) esp_core_dump_flash: N���ɕ�dump partition found!
E (682) esp_core_dump_flash: No core dump partition found!
[     8][D][esp32-hal-cpu.c:244] setCpuFrequencyMhz(): PLL: 480 / 2 = 240 Mhz, APB: 80000000 Hz
��@INFO  | ??:??:?? 0 

//\ E S H T /\ S T / C

INFO  | ??:??:?? 0 Booted, wake cause 0 (boot count 1), reset_reason=reset
DEBUG | ??:??:?? 0 Filesystem files (16384/1048576 Bytes):
DEBUG | ??:??:?? 0  /prefs/channels.proto (53 Bytes)
DEBUG | ??:??:?? 0  /prefs/config.proto (93 Bytes)
DEBUG | ??:??:?? 0  /prefs/db.proto (137 Bytes)
DEBUG | ??:??:?? 0  /prefs/module.proto (98 Bytes)
[   252][I][esp32-hal-i2c.c:75] i2cInit(): Initialising I2C Master: sda=23 scl=22 freq=100000
INFO  | ??:??:?? 0 Scanning for i2c devices...
[   264][W][Wire.cpp:301] begin(): Bus already started in Master Mode.
DEBUG | ??:??:?? 0 Scanning for i2c devices on port 1
DEBUG | ??:??:?? 0 I2C device found at address 0x3c
INFO  | ??:??:?? 0 ssd1306 display found
INFO  | ??:??:?? 0 ssd1306 display found
DEBUG | ??:??:?? 0 0x7 subtype probed in 2 tries 
INFO  | ??:??:?? 0 1 I2C devices found
DEBUG | ??:??:?? 0 acc_info = 0
INFO  | ??:??:?? 0 Meshtastic hwvendor=255, swver=2.2.23.e3c4bc54
DEBUG | ??:??:?? 0 Setting random seed 2416439955
DEBUG | ??:??:?? 0 Total heap: 183108
DEBUG | ??:??:?? 0 Free heap: 148060
DEBUG | ??:??:?? 0 Total PSRAM: 0
DEBUG | ??:??:?? 0 Free PSRAM: 0
DEBUG | ??:??:?? 0 NVS: UsedEntries 284, FreeEntries 346, AllEntries 630, NameSpaces 11
DEBUG | ??:??:?? 0 Setup Preferences in Flash Storage
DEBUG | ??:??:?? 0 Number of Device Reboots: 35
ESP_ERROR_CHECK_WITHOUT_ABORT failed: esp_err_t 0x105 (ESP_ERR_NOT_FOUND) at 0x40096a97
file: "src/platform/esp32/BleOta.cpp" line 16
func: static const esp_partition_t* BleOta::findEspOtaAppPartition()
expression: esp_ota_get_partition_description(part, &app_desc)
ESP_ERROR_CHECK_WITHOUT_ABORT failed: esp_err_t 0x102 (ESP_ERR_INVALID_ARG) at 0x40096a97
file: "src/platform/esp32/BleOta.cpp" line 30
func: static String BleOta::getOtaAppVersion()
expression: esp_ota_get_partition_description(part, &app_desc)
DEBUG | ??:??:?? 0 No OTA firmware available
INFO  | ??:??:?? 0 Initializing NodeDB
INFO  | ??:??:?? 0 Loading /prefs/db.proto
INFO  | ??:??:?? 0 Loaded saved devicestate version 22
INFO  | ??:??:?? 0 Loading /prefs/config.proto
INFO  | ??:??:?? 0 Loaded saved config version 22
INFO  | ??:??:?? 0 Loading /prefs/module.proto
INFO  | ??:??:?? 0 Loaded saved moduleConfig version 22
INFO  | ??:??:?? 0 Loading /prefs/channels.proto
INFO  | ??:??:?? 0 Loaded saved channelFile version 22
[   632][E][vfs_api.cpp:105] open(): /littlefs/oem/oem.proto does not exist, no permits for creation
INFO  | ??:??:?? 0 No /oem/oem.proto preferences found
DEBUG | ??:??:?? 0 cleanupMeshDB purged 0 entries
WARN  | ??:??:?? 0 Using nodenum 0xb2053b70 
DEBUG | ??:??:?? 0 Number of Device Reboots: 35
DEBUG | ??:??:?? 0 Expanding short PSK #1
INFO  | ??:??:?? 0 Wanted region 1, using US
DEBUG | ??:??:?? 0 region=1, NODENUM=0xb2053b70, dbsize=1
INFO  | ??:??:?? 0 Saving /prefs/db.proto
DEBUG | ??:??:?? 0 Using GPIO32 for button
WARN  | ??:??:?? 0 SPI.begin(SCK=18, MISO=19, MOSI=23, NSS=5)
DEBUG | ??:??:?? 0 Read RTC time as 0
INFO  | ??:??:?? 0 Setting GPS power=1
DEBUG | ??:??:?? 0 WANT GPS=1
INFO  | ??:??:?? 0 Setting GPS power=1
DEBUG | ??:??:?? 0 Using GPIO15 for GPS RX
DEBUG | ??:??:?? 0 Using GPIO0 for GPS TX
DEBUG | ??:??:?? 0 NeighborInfoModule is disabled
INFO  | ??:??:?? 0 External Notification Module Disabled
INFO  | ??:??:?? 0 Turning on screen
DEBUG | ??:??:?? 0 Module wants a UI Frame
INFO  | ??:??:?? 0 Not using WIFI
ERROR | ??:??:?? 0 NOTE! Recording critical error 3 at src/main.cpp:916
INFO  | ??:??:?? 0 PowerFSM init, USB ���W��1
DEBUG | ??:??:?? 1 Enter state: BOOT
[  1009][D][esp32-hal-cpu.c:244] setCpuFrequencyMhz(): PLL: 320 / 4 = 80 Mhz, APB: 80000000 Hz
DEBUG | ??:??:?? 1 [Screen] Screen: Started...
DEBUG | ??:??:?? 1 [Screen] Screen: Critical error 3!
DEBUG | ??:??:?? 1 [GPS] WANT GPS=0
INFO  | ??:??:?? 1 [GPS] Setting GPS power=0
INFO  | ??:??:?? 1 [RangeTestModule] Range Test Module - Disabled
INFO  | ??:??:?? 4 [PowerFSM] Initialise the NimBLE bluetooth module
INFO  | ??:??:?? 6 BLE authentication complete
INFO  | ??:??:?? 6 From Radio onread
INFO  | ??:??:?? 6 [Screen] Done with boot screen...
DEBUG | ??:??:?? 6 [Screen] showing standard frames
DEBUG | ??:??:?? 6 [Screen] Showing 0 module frames
DEBUG | ??:??:?? 6 [Screen] Total frame count: 103
DEBUG | ??:??:?? 6 [Screen] Added modules.  numframes: 0
DEBUG | ??:??:?? 6 [Screen] Finished building frames. numframes: 3
INFO  | ??:??:?? 7 To Radio onwrite
INFO  | ??:??:?? 7 Client wants config, nonce=14
INFO  | ??:??:?? 7 Starting API client config
caveman99 commented 5 months ago

That looks if it is not really an SH1107 screen... registers are written in wrong sequence. Rotating won't help you there.