Merge remote-tracking branch 'upstream/master'
This commit is contained in:
commit
e7c25c5436
@ -339,7 +339,7 @@ bool bt_setup_hw() {
|
|||||||
|
|
||||||
Bluefruit.Security.setMITM(true);
|
Bluefruit.Security.setMITM(true);
|
||||||
Bluefruit.Security.setPairPasskeyCallback(bt_passkey_callback);
|
Bluefruit.Security.setPairPasskeyCallback(bt_passkey_callback);
|
||||||
Bluefruit.Periph.setConnectCallback(bt_connect_callback);
|
Bluefruit.Security.setSecuredCallback(bt_connect_callback);
|
||||||
Bluefruit.Periph.setDisconnectCallback(bt_disconnect_callback);
|
Bluefruit.Periph.setDisconnectCallback(bt_disconnect_callback);
|
||||||
Bluefruit.Security.setPairCompleteCallback(bt_pairing_complete);
|
Bluefruit.Security.setPairCompleteCallback(bt_pairing_complete);
|
||||||
const ble_gap_addr_t gap_addr = Bluefruit.getAddr();
|
const ble_gap_addr_t gap_addr = Bluefruit.getAddr();
|
||||||
|
36
Display.h
36
Display.h
@ -106,15 +106,23 @@ void busyCallback(const void* p) {
|
|||||||
#if DISPLAY == OLED
|
#if DISPLAY == OLED
|
||||||
Adafruit_SSD1306 display(DISP_W, DISP_H, &Wire, DISP_RST);
|
Adafruit_SSD1306 display(DISP_W, DISP_H, &Wire, DISP_RST);
|
||||||
float disp_target_fps = 7;
|
float disp_target_fps = 7;
|
||||||
|
#define SCREENSAVER_TIME 500 // ms
|
||||||
|
uint32_t last_screensaver = 0;
|
||||||
|
#define SCREENSAVER_INTERVAL 600000 // 10 minutes in ms
|
||||||
|
bool screensaver_enabled = false;
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#if BOARD_MODEL == BOARD_FREENODE
|
#if BOARD_MODEL == BOARD_FREENODE
|
||||||
#if DISPLAY == EINK_BW
|
#if DISPLAY == EINK_BW
|
||||||
GxEPD2_BW<DISPLAY_MODEL, DISPLAY_MODEL::HEIGHT> display(DISPLAY_MODEL(pin_disp_cs, pin_disp_dc, pin_disp_reset, pin_disp_busy));
|
GxEPD2_BW<DISPLAY_MODEL, DISPLAY_MODEL::HEIGHT> display(DISPLAY_MODEL(pin_disp_cs, pin_disp_dc, pin_disp_reset, pin_disp_busy));
|
||||||
float disp_target_fps = 0.2;
|
float disp_target_fps = 0.2;
|
||||||
|
uint32_t last_epd_refresh = 0;
|
||||||
|
#define REFRESH_PERIOD 300000 // 5 minutes in ms
|
||||||
#elif DISPLAY == EINK_3C
|
#elif DISPLAY == EINK_3C
|
||||||
GxEPD2_3C<DISPLAY_MODEL, DISPLAY_MODEL::HEIGHT> display(DISPLAY_MODEL(pin_disp_cs, pin_disp_dc, pin_disp_reset, pin_disp_busy));
|
GxEPD2_3C<DISPLAY_MODEL, DISPLAY_MODEL::HEIGHT> display(DISPLAY_MODEL(pin_disp_cs, pin_disp_dc, pin_disp_reset, pin_disp_busy));
|
||||||
float disp_target_fps = 0.05; // refresh usually takes longer on 3C, hence 4x the refresh period
|
float disp_target_fps = 0.05; // refresh usually takes longer on 3C, hence this is 4x the BW refresh period
|
||||||
|
uint32_t last_epd_refresh = 0;
|
||||||
|
#define REFRESH_PERIOD 600000 // 10 minutes in ms
|
||||||
#endif
|
#endif
|
||||||
#else
|
#else
|
||||||
// add more eink compatible boards here
|
// add more eink compatible boards here
|
||||||
@ -129,6 +137,7 @@ uint8_t disp_ext_fb = false;
|
|||||||
unsigned char fb[512];
|
unsigned char fb[512];
|
||||||
uint32_t last_disp_update = 0;
|
uint32_t last_disp_update = 0;
|
||||||
int disp_update_interval = 1000/disp_target_fps;
|
int disp_update_interval = 1000/disp_target_fps;
|
||||||
|
|
||||||
uint32_t last_page_flip = 0;
|
uint32_t last_page_flip = 0;
|
||||||
uint32_t last_interface_page_flip = 0;
|
uint32_t last_interface_page_flip = 0;
|
||||||
int page_interval = 4000;
|
int page_interval = 4000;
|
||||||
@ -1111,14 +1120,37 @@ void update_display(bool blank = false) {
|
|||||||
update_stat_area();
|
update_stat_area();
|
||||||
update_disp_area();
|
update_disp_area();
|
||||||
display.display();
|
display.display();
|
||||||
|
|
||||||
|
uint32_t current = millis();
|
||||||
|
// Invert display to protect against OLED screen burn in
|
||||||
|
if (screensaver_enabled) {
|
||||||
|
if (current-last_screensaver >= SCREENSAVER_INTERVAL+SCREENSAVER_TIME) {
|
||||||
|
display.invertDisplay(0);
|
||||||
|
last_screensaver = current;
|
||||||
|
screensaver_enabled = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (current-last_screensaver >= SCREENSAVER_INTERVAL) {
|
||||||
|
display.invertDisplay(1);
|
||||||
|
screensaver_enabled = true;
|
||||||
|
}
|
||||||
#elif DISP_H == 122 && (DISPLAY == EINK_BW || DISPLAY == EINK_3C)
|
#elif DISP_H == 122 && (DISPLAY == EINK_BW || DISPLAY == EINK_3C)
|
||||||
display.setFullWindow();
|
display.setFullWindow();
|
||||||
display.fillScreen(GxEPD_WHITE);
|
display.fillScreen(GxEPD_WHITE);
|
||||||
update_stat_area();
|
update_stat_area();
|
||||||
update_disp_area();
|
update_disp_area();
|
||||||
|
|
||||||
|
uint32_t current = millis();
|
||||||
|
if (current-last_epd_refresh >= REFRESH_PERIOD) {
|
||||||
|
// Perform a full refresh after the correct time has elapsed
|
||||||
|
display.display(false);
|
||||||
|
last_epd_refresh = current;
|
||||||
|
} else {
|
||||||
|
// Only perform a partial refresh
|
||||||
display.display(true);
|
display.display(true);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
last_disp_update = millis();
|
last_disp_update = current;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user