Adding WiFi bugfix from b4sh and minor changes in RX_FSK

This commit is contained in:
DL2MF 2019-04-26 19:21:11 +02:00
parent 86982f6a91
commit 25b438db84
5 changed files with 24 additions and 20 deletions

View File

@ -11,14 +11,13 @@
#include <Scanner.h>
#include <aprs.h>
#define LORA_LED 9
// UNCOMMENT one of the constructor lines below
U8X8_SSD1306_128X64_NONAME_SW_I2C *u8x8=NULL; // initialize later after reading config file
//U8X8_SSD1306_128X64_NONAME_SW_I2C u8x8(/* clock=*/ OLED_SCL, /* data=*/ OLED_SDA, /* reset=*/ OLED_RST); // Unbuffered, basic graphics, software I2C
//U8G2_SSD1306_128X64_NONAME_1_SW_I2C Display(U8G2_R0, /* clock=*/ OLED_SCL, /* data=*/ OLED_SDA, /* reset=*/ OLED_RST); // Page buffer, SW I2C
//U8G2_SSD1306_128X64_NONAME_F_SW_I2C Display(U8G2_R0, /* clock=*/ OLED_SCL, /* data=*/ OLED_SDA, /* reset=*/ OLED_RST); // Full framebuffer, SW I2C
int LORA_LED = 9; // default POUT for LORA LED used as serial monitor
int e;
AsyncWebServer server(80);
@ -49,8 +48,6 @@ String processor(const String& var){
return String();
}
#define MAX_QRG 10
const String sondeTypeSelect(int activeType) {
String sts = "";
for(int i=0; i<3; i++) {
@ -137,7 +134,7 @@ const char *handleQRGPost(AsyncWebServerRequest *request) {
Serial.println(request->getParam(i)->name().c_str());
}
#endif
for(int i=1; i<=MAX_QRG; i++) {
for(int i=1; i<=sonde.config.maxsonde; i++) {
snprintf(label, 10, "A%d", i);
AsyncWebParameter *active = request->getParam(label, true);
snprintf(label, 10, "F%d", i);
@ -484,6 +481,7 @@ void setup()
}
setupConfigData(); // configuration must be read first due to OLED ports!!!
LORA_LED = sonde.config.led_pout;
u8x8 = new U8X8_SSD1306_128X64_NONAME_SW_I2C(/* clock=*/ sonde.config.oled_scl, /* data=*/ sonde.config.oled_sda, /* reset=*/ sonde.config.oled_rst); // Unbuffered, basic graphics, software I2C
u8x8->begin();
@ -523,7 +521,7 @@ void setup()
u8x8->drawString(6, 3, buf);
delay(1000);
itoa(sonde.config.led_pin, buf, 10);
itoa(sonde.config.led_pout, buf, 10);
u8x8->drawString(0, 4, " LED:");
u8x8->drawString(6, 4, buf);
@ -608,6 +606,8 @@ void loopDecoder() {
switch(getKeyPress()) {
case KP_SHORT:
sonde.nextConfig();
sonde.updateDisplayRXConfig();
sonde.updateDisplay();
break;
case KP_DOUBLE:
enterMode(ST_SCANNER);
@ -741,7 +741,7 @@ void loopWifiScan() {
WiFi.disconnect(true);
WiFi.mode(WIFI_STA);
const char *id, *pw;
const char *id, *pw, *wifipw;
char idstr[64]="test";
if (sonde.config.wifi != 0) {
@ -761,16 +761,19 @@ void loopWifiScan() {
Serial.println("-----------------------");
id=WiFi.SSID(i).c_str();
pw=fetchWifiPw(id);
if(pw) { strncpy(idstr, id, 63); }
if(pw) {
strncpy(idstr, id, 63);
wifipw = pw;
}
if(!pw) { pw="test"; }
}
if(!wifipw) { wifipw="test"; }
Serial.print("Connecting to: "); Serial.println(idstr);
u8x8->drawString(0,6, "Conn:");
u8x8->drawString(6,6, idstr);
//register event handler
WiFi.onEvent(WiFiEvent);
WiFi.begin(idstr, pw);
WiFi.begin(idstr, wifipw);
}
while(WiFi.status() != WL_CONNECTED) {
@ -782,7 +785,7 @@ void loopWifiScan() {
if(cnt==4) {
WiFi.disconnect(true); // retry, for my buggy FritzBox
WiFi.onEvent(WiFiEvent);
WiFi.begin(idstr, pw);
WiFi.begin(idstr, wifipw);
}
#endif
if(cnt==15) {

View File

@ -3,7 +3,7 @@
#-------------------------------#
button_pin=0
# LED port
led_pin=25
led_pout=9
# OLED Setup is depending on hardware of LoRa board
# TTGO v1: SDA=4 SCL=15, RST=16
# TTGO v2: SDA=21 SCL=22, RST=16
@ -15,7 +15,7 @@ oled_rst=16
#-------------------------------#
maxsonde=20
debug=0
wifi=0
wifi=1
wifiap=1
#-------------------------------#
# Spectrum display settings

View File

@ -1,4 +1,4 @@
AUTORX
12345678
SONDERX
WXSONDE
radiosonde

View File

@ -49,6 +49,7 @@ static uint8_t ap_tile[8]={0x00,0x04,0x22,0x92, 0x92, 0x22, 0x04, 0x00};
Sonde::Sonde() {
config.button_pin = 1;
config.led_pout = 9;
//config.oled_sda = 0;
//config.oled_scl = 0;
//config.oled_rst = 0;
@ -98,8 +99,8 @@ void Sonde::setConfig(const char *cfg) {
strncpy(config.passcode, val, 9);
} else if(strcmp(cfg,"button_pin")==0) {
config.button_pin = atoi(val);
} else if(strcmp(cfg,"led_pin")==0) {
config.led_pin = atoi(val);
} else if(strcmp(cfg,"led_pout")==0) {
config.led_pout = atoi(val);
} else if(strcmp(cfg,"oled_sda")==0) {
config.oled_sda = atoi(val);
} else if(strcmp(cfg,"oled_scl")==0) {

View File

@ -13,8 +13,8 @@ enum SondeType { STYPE_DFM06, STYPE_DFM09, STYPE_RS41 };
extern const char *sondeTypeStr[5];
typedef struct st_rdzconfig {
int button_pin; // pin number of second button (for some boards)
int led_pin; // pin number of LED
int button_pin; // PIN port number menu button (for some boards)
int led_pout; // POUT port number of LED (used as serial monitor)
int oled_sda; // OLED data pin
int oled_scl; // OLED clock pin
int oled_rst; // OLED reset pin