mirror of
https://github.com/meshtastic/firmware.git
synced 2025-12-22 18:52:30 +00:00
Autodetect OLED Controller 1306/1106 (#1317)
* Autodetect OLED Controller 1306/1106 and make #define NO_SCREEN work again * fix epaper with autodetect * Try kicking CI - NFC
This commit is contained in:
@@ -3,6 +3,27 @@
|
||||
#include <Wire.h>
|
||||
|
||||
#ifndef NO_WIRE
|
||||
uint8_t oled_probe(byte addr)
|
||||
{
|
||||
uint8_t r = 0;
|
||||
uint8_t o_probe = 0;
|
||||
Wire.beginTransmission(addr);
|
||||
Wire.write(0x00);
|
||||
Wire.endTransmission();
|
||||
Wire.requestFrom((int)addr, 1);
|
||||
if (Wire.available()) {
|
||||
r = Wire.read();
|
||||
}
|
||||
r &= 0x0f;
|
||||
if (r == 0x08) {
|
||||
o_probe = 2; // SH1106
|
||||
} else if ( r == 0x06 || r == 0x07) {
|
||||
o_probe = 1; // SSD1306
|
||||
}
|
||||
DEBUG_MSG("0x%x subtype probed\n", r);
|
||||
return o_probe;
|
||||
}
|
||||
|
||||
void scanI2Cdevice(void)
|
||||
{
|
||||
byte err, addr;
|
||||
@@ -17,7 +38,14 @@ void scanI2Cdevice(void)
|
||||
|
||||
if (addr == SSD1306_ADDRESS) {
|
||||
screen_found = addr;
|
||||
DEBUG_MSG("ssd1306 display found\n");
|
||||
screen_model = oled_probe(addr);
|
||||
if (screen_model == 1){
|
||||
DEBUG_MSG("ssd1306 display found\n");
|
||||
} else if (screen_model == 2){
|
||||
DEBUG_MSG("sh1106 display found\n");
|
||||
} else {
|
||||
DEBUG_MSG("unknown display found\n");
|
||||
}
|
||||
}
|
||||
if (addr == ST7567_ADDRESS) {
|
||||
screen_found = addr;
|
||||
|
||||
Reference in New Issue
Block a user