#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
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"));
} else if (WiFi.status() != WL_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;
*/
if (WiFi.status() == WL_CONNECTED) {
if (radioConfig.preferences.wifi_ap_mode) {
if (WiFi.status() == WL_CONNECTED || isSoftAPForced()) {
if (radioConfig.preferences.wifi_ap_mode || isSoftAPForced()) {
display->drawString(x, y + FONT_HEIGHT_SMALL * 1, "IP: " + String(WiFi.softAPIP().toString().c_str()));
} else {
display->drawString(x, y + FONT_HEIGHT_SMALL * 1, "IP: " + String(WiFi.localIP().toString().c_str()));
@ -1088,10 +1087,19 @@ void DebugInfo::drawFrameWiFi(OLEDDisplay *display, OLEDDisplayUiState *state, i
}
}
if ((millis() / 10000) % 2) {
display->drawString(x, y + FONT_HEIGHT_SMALL * 2, "SSID: " + String(wifiName));
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 {
display->drawString(x, y + FONT_HEIGHT_SMALL * 2, "PWD: " + String(wifiPsw));
if ((millis() / 10000) % 2) {
display->drawString(x, y + FONT_HEIGHT_SMALL * 2, "SSID: " + String(wifiName));
} else {
display->drawString(x, y + FONT_HEIGHT_SMALL * 2, "PWD: " + String(wifiPsw));
}
}
display->drawString(x, y + FONT_HEIGHT_SMALL * 3, "http://meshtastic.local");
@ -1185,8 +1193,7 @@ int Screen::handleStatusUpdate(const meshtastic::Status *arg)
// DEBUG_MSG("Screen got status update %d\n", arg->getStatusType());
switch (arg->getStatusType()) {
case STATUS_TYPE_NODE:
if (showingNormalScreen &&
nodeStatus->getLastNumTotal() != nodeStatus->getNumTotal()) {
if (showingNormalScreen && nodeStatus->getLastNumTotal() != nodeStatus->getNumTotal()) {
setFrames(); // Regen the list of screens
}
nodeDB.updateGUI = false;

View File

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

View File

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