mirror of
https://github.com/liberatedsystems/RNode_Firmware_CE.git
synced 2025-04-28 03:16:20 -04:00
Implemented display rotation on Heltec T114
This commit is contained in:
parent
95895f3756
commit
becc3d0e3d
43
Display.h
43
Display.h
@ -19,7 +19,7 @@
|
|||||||
#if BOARD_MODEL == BOARD_TDECK
|
#if BOARD_MODEL == BOARD_TDECK
|
||||||
#include <Adafruit_ST7789.h>
|
#include <Adafruit_ST7789.h>
|
||||||
#elif BOARD_MODEL == BOARD_HELTEC_T114
|
#elif BOARD_MODEL == BOARD_HELTEC_T114
|
||||||
#include "ST7789Spi.h"
|
#include "ST7789.h"
|
||||||
#define COLOR565(r, g, b) (((r & 0xF8) << 8) | ((g & 0xFC) << 3) | ((b & 0xF8) >> 3))
|
#define COLOR565(r, g, b) (((r & 0xF8) << 8) | ((g & 0xFC) << 3) | ((b & 0xF8) >> 3))
|
||||||
#elif BOARD_MODEL == BOARD_TBEAM_S_V1
|
#elif BOARD_MODEL == BOARD_TBEAM_S_V1
|
||||||
#include <Adafruit_SH110X.h>
|
#include <Adafruit_SH110X.h>
|
||||||
@ -127,17 +127,31 @@ GFXcanvas1 stat_area(64, 64);
|
|||||||
GFXcanvas1 disp_area(64, 64);
|
GFXcanvas1 disp_area(64, 64);
|
||||||
|
|
||||||
void update_area_positions() {
|
void update_area_positions() {
|
||||||
if (disp_mode == DISP_MODE_PORTRAIT) {
|
#if BOARD_MODEL != BOARD_HELTEC_T114
|
||||||
p_ad_x = 0 * DISPLAY_SCALE;
|
if (disp_mode == DISP_MODE_PORTRAIT) {
|
||||||
p_ad_y = 0 * DISPLAY_SCALE;
|
p_ad_x = 0 * DISPLAY_SCALE;
|
||||||
p_as_x = 0 * DISPLAY_SCALE;
|
p_ad_y = 0 * DISPLAY_SCALE;
|
||||||
p_as_y = 64 * DISPLAY_SCALE;
|
p_as_x = 0 * DISPLAY_SCALE;
|
||||||
} else if (disp_mode == DISP_MODE_LANDSCAPE) {
|
p_as_y = 64 * DISPLAY_SCALE;
|
||||||
p_ad_x = 0 * DISPLAY_SCALE;
|
} else if (disp_mode == DISP_MODE_LANDSCAPE) {
|
||||||
p_ad_y = 0 * DISPLAY_SCALE;
|
p_ad_x = 0 * DISPLAY_SCALE;
|
||||||
p_as_x = 64 * DISPLAY_SCALE;
|
p_ad_y = 0 * DISPLAY_SCALE;
|
||||||
p_as_y = 0 * DISPLAY_SCALE;
|
p_as_x = 64 * DISPLAY_SCALE;
|
||||||
}
|
p_as_y = 0 * DISPLAY_SCALE;
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
if (disp_mode == DISP_MODE_PORTRAIT) {
|
||||||
|
p_ad_x = 16;
|
||||||
|
p_ad_y = 64;
|
||||||
|
p_as_x = 16;
|
||||||
|
p_as_y = p_ad_y+126;
|
||||||
|
} else if (disp_mode == DISP_MODE_LANDSCAPE) {
|
||||||
|
p_ad_x = 0;
|
||||||
|
p_ad_y = 96;
|
||||||
|
p_as_x = 126;
|
||||||
|
p_as_y = p_ad_y;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t display_contrast = 0x00;
|
uint8_t display_contrast = 0x00;
|
||||||
@ -282,9 +296,7 @@ bool display_init() {
|
|||||||
} else {
|
} else {
|
||||||
disp_mode = DISP_MODE_PORTRAIT;
|
disp_mode = DISP_MODE_PORTRAIT;
|
||||||
}
|
}
|
||||||
#if BOARD_MODEL != BOARD_HELTEC_T114
|
|
||||||
display.setRotation(display_rotation);
|
display.setRotation(display_rotation);
|
||||||
#endif
|
|
||||||
} else {
|
} else {
|
||||||
#if BOARD_MODEL == BOARD_RNODE_NG_20
|
#if BOARD_MODEL == BOARD_RNODE_NG_20
|
||||||
disp_mode = DISP_MODE_PORTRAIT;
|
disp_mode = DISP_MODE_PORTRAIT;
|
||||||
@ -314,7 +326,8 @@ bool display_init() {
|
|||||||
disp_mode = DISP_MODE_PORTRAIT;
|
disp_mode = DISP_MODE_PORTRAIT;
|
||||||
display.setRotation(1);
|
display.setRotation(1);
|
||||||
#elif BOARD_MODEL == BOARD_HELTEC_T114
|
#elif BOARD_MODEL == BOARD_HELTEC_T114
|
||||||
disp_mode = DISP_MODE_LANDSCAPE;
|
disp_mode = DISP_MODE_PORTRAIT;
|
||||||
|
display.setRotation(1);
|
||||||
#elif BOARD_MODEL == BOARD_RAK4631
|
#elif BOARD_MODEL == BOARD_RAK4631
|
||||||
disp_mode = DISP_MODE_LANDSCAPE;
|
disp_mode = DISP_MODE_LANDSCAPE;
|
||||||
display.setRotation(0);
|
display.setRotation(0);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user