Screen changes and fixes (#1651)

* Fixed bluetooth reinit bug

* Remove screen transition ms

* Whoops

* hasScreen is smarter now

* Oops
This commit is contained in:
Ben Meadors 2022-08-25 11:25:05 -05:00 committed by GitHub
parent d7e5eb4d22
commit 1013aff9b6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 9 additions and 21 deletions

View File

@ -112,9 +112,6 @@ static uint16_t displayWidth, displayHeight;
#define getStringCenteredX(s) ((SCREEN_WIDTH - display->getStringWidth(s)) / 2) #define getStringCenteredX(s) ((SCREEN_WIDTH - display->getStringWidth(s)) / 2)
#ifndef SCREEN_TRANSITION_MSECS
#define SCREEN_TRANSITION_MSECS 300
#endif
/** /**
* Draw the icon with extra info printed around the corners * Draw the icon with extra info printed around the corners
@ -902,7 +899,7 @@ void Screen::setup()
displayWidth = dispdev.width(); displayWidth = dispdev.width();
displayHeight = dispdev.height(); displayHeight = dispdev.height();
ui.setTimePerTransition(SCREEN_TRANSITION_MSECS); ui.setTimePerTransition(0);
ui.setIndicatorPosition(BOTTOM); ui.setIndicatorPosition(BOTTOM);
// Defines where the first frame is located in the bar. // Defines where the first frame is located in the bar.
@ -1069,10 +1066,6 @@ int32_t Screen::runOnce()
DEBUG_MSG("Setting idle framerate\n"); DEBUG_MSG("Setting idle framerate\n");
targetFramerate = IDLE_FRAMERATE; targetFramerate = IDLE_FRAMERATE;
#ifdef ARCH_ESP32
setCPUFast(false); // Turn up the CPU to improve screen animations
#endif
ui.setTargetFPS(targetFramerate); ui.setTargetFPS(targetFramerate);
forceDisplay(); forceDisplay();
} }
@ -1313,10 +1306,6 @@ void Screen::setFastFramerate()
// We are about to start a transition so speed up fps // We are about to start a transition so speed up fps
targetFramerate = SCREEN_TRANSITION_FRAMERATE; targetFramerate = SCREEN_TRANSITION_FRAMERATE;
#ifdef ARCH_ESP32
setCPUFast(true); // Turn up the CPU to improve screen animations
#endif
ui.setTargetFPS(targetFramerate); ui.setTargetFPS(targetFramerate);
setInterval(0); // redraw ASAP setInterval(0); // redraw ASAP
runASAP = true; runASAP = true;

View File

@ -159,7 +159,12 @@ void NodeDB::installDefaultConfig()
// FIXME: Default to bluetooth capability of platform as default // FIXME: Default to bluetooth capability of platform as default
config.bluetooth.enabled = true; config.bluetooth.enabled = true;
config.bluetooth.fixed_pin = defaultBLEPin; config.bluetooth.fixed_pin = defaultBLEPin;
config.bluetooth.mode = screen_found ? Config_BluetoothConfig_PairingMode_RandomPin : Config_BluetoothConfig_PairingMode_FixedPin; #if defined(ST7735_CS) || defined(USE_EINK) || defined(ILI9341_DRIVER)
bool hasScreen = true;
#else
bool hasScreen = screen_found;
#endif
config.bluetooth.mode = hasScreen ? Config_BluetoothConfig_PairingMode_RandomPin : Config_BluetoothConfig_PairingMode_FixedPin;
// for backward compat, default position flags are ALT+MSL // for backward compat, default position flags are ALT+MSL
config.position.position_flags = (Config_PositionConfig_PositionFlags_POS_ALTITUDE | Config_PositionConfig_PositionFlags_POS_ALT_MSL); config.position.position_flags = (Config_PositionConfig_PositionFlags_POS_ALTITUDE | Config_PositionConfig_PositionFlags_POS_ALT_MSL);
} }

View File

@ -122,8 +122,7 @@ void NimbleBluetooth::shutdown()
bool NimbleBluetooth::isActive() bool NimbleBluetooth::isActive()
{ {
NimBLEAdvertising *pAdvertising = NimBLEDevice::getAdvertising(); return bleServer;
return bleServer && (bleServer->getConnectedCount() > 0 || pAdvertising->isAdvertising());
} }
void NimbleBluetooth::setup() void NimbleBluetooth::setup()

View File

@ -29,7 +29,7 @@ void setBluetoothEnable(bool on) {
} }
if (on && !nimbleBluetooth->isActive()) { if (on && !nimbleBluetooth->isActive()) {
nimbleBluetooth->setup(); nimbleBluetooth->setup();
} else { } else if (!on) {
nimbleBluetooth->shutdown(); nimbleBluetooth->shutdown();
} }
} }

View File

@ -39,5 +39,4 @@
#define SCREEN_ROTATE #define SCREEN_ROTATE
// LCD screens are slow, so slowdown the wipe so it looks better // LCD screens are slow, so slowdown the wipe so it looks better
#define SCREEN_TRANSITION_MSECS 1
#define SCREEN_TRANSITION_FRAMERATE 1 // fps #define SCREEN_TRANSITION_FRAMERATE 1 // fps

View File

@ -126,7 +126,6 @@ static const uint8_t AREF = PIN_AREF;
#define SCREEN_MIRROR #define SCREEN_MIRROR
// LCD screens are slow, so slowdown the wipe so it looks better // LCD screens are slow, so slowdown the wipe so it looks better
#define SCREEN_TRANSITION_MSECS 1000
#define SCREEN_TRANSITION_FRAMERATE 10 // fps #define SCREEN_TRANSITION_FRAMERATE 10 // fps
/* /*

View File

@ -158,9 +158,6 @@ External serial flash WP25R1635FZUIL0
#define USE_EINK #define USE_EINK
// No screen wipes on eink
#define SCREEN_TRANSITION_MSECS 0
#define PIN_SPI1_MISO \ #define PIN_SPI1_MISO \
(32 + 7) // FIXME not really needed, but for now the SPI code requires something to be defined, pick an used GPIO (32 + 7) // FIXME not really needed, but for now the SPI code requires something to be defined, pick an used GPIO
#define PIN_SPI1_MOSI PIN_EINK_MOSI #define PIN_SPI1_MOSI PIN_EINK_MOSI