Display AP connection usage only when in AP mode

This commit is contained in:
Jm 2020-12-31 20:17:18 -08:00
parent 7b80b95381
commit 349701ac14
2 changed files with 13 additions and 11 deletions

View File

@ -38,8 +38,8 @@ build_flags = -Wno-missing-field-initializers -Isrc -Isrc/mesh -Isrc/gps -Ilib/n
;upload_port = /dev/ttyUSB0 ;upload_port = /dev/ttyUSB0
;monitor_port = /dev/ttyUSB0 ;monitor_port = /dev/ttyUSB0
;upload_port = /dev/cu.SLAB_USBtoUART upload_port = /dev/cu.SLAB_USBtoUART
;monitor_port = /dev/cu.SLAB_USBtoUART monitor_port = /dev/cu.SLAB_USBtoUART
; the default is esptool ; the default is esptool
; upload_protocol = esp-prog ; upload_protocol = esp-prog

View File

@ -27,6 +27,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "NodeDB.h" #include "NodeDB.h"
#include "Screen.h" #include "Screen.h"
#include "configuration.h" #include "configuration.h"
#include "fonts.h"
#include "graphics/images.h" #include "graphics/images.h"
#include "main.h" #include "main.h"
#include "mesh-pb-constants.h" #include "mesh-pb-constants.h"
@ -34,7 +35,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "plugins/TextMessagePlugin.h" #include "plugins/TextMessagePlugin.h"
#include "target_specific.h" #include "target_specific.h"
#include "utils.h" #include "utils.h"
#include "fonts.h"
using namespace meshtastic; /** @todo remove */ using namespace meshtastic; /** @todo remove */
@ -42,7 +42,7 @@ namespace graphics
{ {
// This means the *visible* area (sh1106 can address 132, but shows 128 for example) // This means the *visible* area (sh1106 can address 132, but shows 128 for example)
#define IDLE_FRAMERATE 1 // in fps #define IDLE_FRAMERATE 1 // in fps
#define COMPASS_DIAM 44 #define COMPASS_DIAM 44
// DEBUG // DEBUG
@ -177,7 +177,6 @@ static void drawCriticalFaultFrame(OLEDDisplay *display, OLEDDisplayUiState *sta
display->drawString(0 + x, FONT_HEIGHT_MEDIUM + y, "For help, please post on\nmeshtastic.discourse.group"); display->drawString(0 + x, FONT_HEIGHT_MEDIUM + y, "For help, please post on\nmeshtastic.discourse.group");
} }
/// Draw the last text message we received /// Draw the last text message we received
static void drawTextMessageFrame(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y) static void drawTextMessageFrame(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y)
{ {
@ -924,20 +923,21 @@ void Screen::handleStartBluetoothPinScreen(uint32_t pin)
setFastFramerate(); setFastFramerate();
} }
void Screen::blink() { void Screen::blink()
{
setFastFramerate(); setFastFramerate();
uint8_t count = 10; uint8_t count = 10;
dispdev.setBrightness(254); dispdev.setBrightness(254);
while(count>0) { while (count > 0) {
dispdev.fillRect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT); dispdev.fillRect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
dispdev.display(); dispdev.display();
delay(50); delay(50);
dispdev.clear(); dispdev.clear();
dispdev.display(); dispdev.display();
delay(50); delay(50);
count = count -1; count = count - 1;
} }
dispdev.setBrightness(brightness); dispdev.setBrightness(brightness);
} }
void Screen::handlePrint(const char *text) void Screen::handlePrint(const char *text)
@ -1060,11 +1060,13 @@ void DebugInfo::drawFrameWiFi(OLEDDisplay *display, OLEDDisplayUiState *state, i
if (WiFi.status() == WL_CONNECTED || isSoftAPForced() || radioConfig.preferences.wifi_ap_mode) { if (WiFi.status() == WL_CONNECTED || isSoftAPForced() || radioConfig.preferences.wifi_ap_mode) {
if (radioConfig.preferences.wifi_ap_mode || isSoftAPForced()) { if (radioConfig.preferences.wifi_ap_mode || isSoftAPForced()) {
display->drawString(x, y + FONT_HEIGHT_SMALL * 1, "IP: " + String(WiFi.softAPIP().toString().c_str())); display->drawString(x, y + FONT_HEIGHT_SMALL * 1, "IP: " + String(WiFi.softAPIP().toString().c_str()));
// Number of connections to the AP. Default mmax for the esp32 is 4
display->drawString(x + SCREEN_WIDTH - display->getStringWidth("(" + String(WiFi.softAPgetStationNum()) + "/4)"),
y + FONT_HEIGHT_SMALL * 1, "(" + String(WiFi.softAPgetStationNum()) + "/4)");
} else { } else {
display->drawString(x, y + FONT_HEIGHT_SMALL * 1, "IP: " + String(WiFi.localIP().toString().c_str())); display->drawString(x, y + FONT_HEIGHT_SMALL * 1, "IP: " + String(WiFi.localIP().toString().c_str()));
} }
display->drawString(x + SCREEN_WIDTH - display->getStringWidth("(" + String(WiFi.softAPgetStationNum()) + "/4)"),
y + FONT_HEIGHT_SMALL * 1, "(" + String(WiFi.softAPgetStationNum()) + "/4)");
} else if (WiFi.status() == WL_NO_SSID_AVAIL) { } else if (WiFi.status() == WL_NO_SSID_AVAIL) {
display->drawString(x, y + FONT_HEIGHT_SMALL * 1, "SSID Not Found"); display->drawString(x, y + FONT_HEIGHT_SMALL * 1, "SSID Not Found");