#560 Partial changes

This commit is contained in:
Jm Casler 2020-12-12 19:09:58 -08:00
parent d82aaaa806
commit e10b82c118
3 changed files with 25 additions and 12 deletions

View File

@ -984,7 +984,7 @@ void DebugInfo::drawFrameWiFi(OLEDDisplay *display, OLEDDisplayUiState *state, i
// The coordinates define the left starting point of the text // The coordinates define the left starting point of the text
display->setTextAlignment(TEXT_ALIGN_LEFT); display->setTextAlignment(TEXT_ALIGN_LEFT);
if (radioConfig.preferences.wifi_ap_mode) { if (radioConfig.preferences.wifi_ap_mode || isSoftAPForced()) {
display->drawString(x, y, String("WiFi: Software AP")); display->drawString(x, y, String("WiFi: Software AP"));
} else if (WiFi.status() != WL_CONNECTED) { } else if (WiFi.status() != WL_CONNECTED) {
display->drawString(x, y, String("WiFi: Not Connected")); display->drawString(x, y, String("WiFi: Not Connected"));
@ -1007,9 +1007,8 @@ void DebugInfo::drawFrameWiFi(OLEDDisplay *display, OLEDDisplayUiState *state, i
- WL_NO_SHIELD: assigned when no WiFi shield is present; - WL_NO_SHIELD: assigned when no WiFi shield is present;
*/ */
if (WiFi.status() == WL_CONNECTED || isSoftAPForced()) {
if (WiFi.status() == WL_CONNECTED) { if (radioConfig.preferences.wifi_ap_mode || isSoftAPForced()) {
if (radioConfig.preferences.wifi_ap_mode) {
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()));
} 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()));
@ -1088,11 +1087,20 @@ void DebugInfo::drawFrameWiFi(OLEDDisplay *display, OLEDDisplayUiState *state, i
} }
} }
if (isSoftAPForced()) {
if ((millis() / 10000) % 2) {
display->drawString(x, y + FONT_HEIGHT_SMALL * 2, "SSID: meshtasticAdmin");
} else {
display->drawString(x, y + FONT_HEIGHT_SMALL * 2, "PWD: 12345678");
}
} else {
if ((millis() / 10000) % 2) { if ((millis() / 10000) % 2) {
display->drawString(x, y + FONT_HEIGHT_SMALL * 2, "SSID: " + String(wifiName)); display->drawString(x, y + FONT_HEIGHT_SMALL * 2, "SSID: " + String(wifiName));
} else { } else {
display->drawString(x, y + FONT_HEIGHT_SMALL * 2, "PWD: " + String(wifiPsw)); display->drawString(x, y + FONT_HEIGHT_SMALL * 2, "PWD: " + String(wifiPsw));
} }
}
display->drawString(x, y + FONT_HEIGHT_SMALL * 3, "http://meshtastic.local"); display->drawString(x, y + FONT_HEIGHT_SMALL * 3, "http://meshtastic.local");
/* Display a heartbeat pixel that blinks every time the frame is redrawn */ /* Display a heartbeat pixel that blinks every time the frame is redrawn */
@ -1185,8 +1193,7 @@ int Screen::handleStatusUpdate(const meshtastic::Status *arg)
// DEBUG_MSG("Screen got status update %d\n", arg->getStatusType()); // DEBUG_MSG("Screen got status update %d\n", arg->getStatusType());
switch (arg->getStatusType()) { switch (arg->getStatusType()) {
case STATUS_TYPE_NODE: case STATUS_TYPE_NODE:
if (showingNormalScreen && if (showingNormalScreen && nodeStatus->getLastNumTotal() != nodeStatus->getNumTotal()) {
nodeStatus->getLastNumTotal() != nodeStatus->getNumTotal()) {
setFrames(); // Regen the list of screens setFrames(); // Regen the list of screens
} }
nodeDB.updateGUI = false; nodeDB.updateGUI = false;

View File

@ -24,10 +24,14 @@ char ourHost[16];
bool forcedSoftAP = 0; bool forcedSoftAP = 0;
bool isSoftAPForced() {
return forcedSoftAP;
}
bool isWifiAvailable() bool isWifiAvailable()
{ {
// If wifi status is connected, return true regardless of the radio configuration. // If wifi status is connected, return true regardless of the radio configuration.
if (forcedSoftAP) { if (isSoftAPForced()) {
return 1; return 1;
} }
@ -91,8 +95,8 @@ void initWifi(bool forceSoftAP)
DEBUG_MSG("----- Forcing SoftAP\n"); DEBUG_MSG("----- Forcing SoftAP\n");
const char *softAPssid = ""; const char *softAPssid = "meshtasticAdmin";
const char *softAPpasswd = ""; const char *softAPpasswd = "12345678";
IPAddress apIP(192, 168, 42, 1); IPAddress apIP(192, 168, 42, 1);
WiFi.onEvent(WiFiEvent); WiFi.onEvent(WiFiEvent);

View File

@ -18,5 +18,7 @@ void handleDNSResponse();
void reconnectWiFi(); void reconnectWiFi();
bool isSoftAPForced();
uint8_t getWifiDisconnectReason(); uint8_t getWifiDisconnectReason();