Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions SmartHandController.ino
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,10 @@ const KeyPad::Pin pins[7]= {
void setup(void) {

// start debug serial port
if (DEBUG == ON || DEBUG == VERBOSE) SERIAL_DEBUG.begin(SERIAL_DEBUG_BAUD);
delay(2000);
if (DEBUG == ON || DEBUG == VERBOSE) {
SERIAL_DEBUG.begin(SERIAL_DEBUG_BAUD);
delay(2000);
}

VF("MSG: Smart Hand Controller "); V(FirmwareVersionMajor); V("."); V(FirmwareVersionMinor); VL(FirmwareVersionPatch);
VF("MSG: MCU = "); VLF(MCU_STR);
Expand Down
14 changes: 13 additions & 1 deletion src/pinmaps/Pins.Esp32.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,18 @@
#endif

#ifndef DISPLAY_RESET_PIN
#define DISPLAY_RESET_PIN 16 // GPIO16 used to reset some displays, i.e. the SSD1309
#define DISPLAY_RESET_PIN 16 // GPIO16 used to reset some displays, i.e. the SSD1309
#endif
#ifndef DISPLAY_DC_PIN
#define DISPLAY_DC_PIN 15 // SPI display data/clock pin
#endif
#ifndef DISPLAY_SS_PIN
#define DISPLAY_SS_PIN 4 // SPI display slave select pin
#endif
#ifndef DISPLAY_MOSI_PIN
#define DISPLAY_MOSI_PIN 21 // SPI display master out slave in pin (ignored for hardware SPI connections)
#endif
#ifndef DISPLAY_SCK_PIN
#define DISPLAY_SCK_PIN 22 // SPI display clock pin for (ignored for hardware SPI connections)
#endif
#endif
11 changes: 5 additions & 6 deletions src/userInterface/UserInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,8 @@ void UI::init(const char version[], const KeyPad::Pin pins[7], const int SerialB
pinMode(B_PIN1, INPUT_PULLUP);
pinMode(B_PIN3, INPUT_PULLUP);
delay(100);
int thresholdEW = analogRead(B_PIN1);
int thresholdNS = analogRead(B_PIN3);
int thresholdEW = analogRead(B_PIN1) >> 2;
int thresholdNS = analogRead(B_PIN3) >> 2;
keyPad.init(pins, thresholdNS, thresholdEW);
#else
keyPad.init(pins, 0, 0);
Expand All @@ -146,13 +146,12 @@ void UI::init(const char version[], const KeyPad::Pin pins[7], const int SerialB
#endif

//choose a 128x64 display supported by U8G2lib (if not listed below there are many many others in u8g2 library example Sketches)
delay(500);
if (model == OLED_SH1106) display = new U8G2_EXT_SH1106_128X64_NONAME_1_HW_I2C(U8G2_R0); else
if (model == OLED_SH1106_4W_SW_SPI) display = new U8G2_EXT_SH1106_128X64_NONAME_1_4W_SW_SPI(U8G2_R0); else
if (model == OLED_SH1106_4W_HW_SPI) display = new U8G2_EXT_SH1106_128X64_NONAME_1_4W_HW_SPI(U8G2_R0);
if (model == OLED_SH1106_4W_SW_SPI) display = new U8G2_EXT_SH1106_128X64_NONAME_1_4W_SW_SPI(U8G2_R0, DISPLAY_SCK_PIN, DISPLAY_MOSI_PIN, DISPLAY_SS_PIN, DISPLAY_DC_PIN, DISPLAY_RESET_PIN); else
if (model == OLED_SH1106_4W_HW_SPI) display = new U8G2_EXT_SH1106_128X64_NONAME_1_4W_HW_SPI(U8G2_R0); else
if (model == OLED_SSD1306) display = new U8G2_EXT_SSD1306_128X64_NONAME_F_HW_I2C(U8G2_R0); else
if (model == OLED_SSD1309) display = new U8G2_EXT_SSD1309_128X64_NONAME_F_HW_I2C(U8G2_R0); else
if (model == OLED_SSD1309_4W_SW_SPI) display = new U8G2_EXT_SSD1309_128X64_NONAME_F_4W_SW_SPI(U8G2_R0); else
if (model == OLED_SSD1309_4W_SW_SPI) display = new U8G2_EXT_SSD1309_128X64_NONAME_F_4W_SW_SPI(U8G2_R0, DISPLAY_SCK_PIN, DISPLAY_MOSI_PIN, DISPLAY_SS_PIN, DISPLAY_DC_PIN, DISPLAY_RESET_PIN); else
if (model == OLED_SSD1309_4W_HW_SPI) display = new U8G2_EXT_SSD1309_128X64_NONAME_F_4W_HW_SPI(U8G2_R0);

display->begin();
Expand Down