From 6beba5c112c039b061f64efd9ab88206daa6972e Mon Sep 17 00:00:00 2001 From: Holger Wirtz Date: Tue, 20 Oct 2020 09:27:42 +0200 Subject: [PATCH] iBetter conenction handling. --- OSC2MIDI.ino | 56 +++++++++++++++++++++++++++++++++------------------- 1 file changed, 36 insertions(+), 20 deletions(-) diff --git a/OSC2MIDI.ino b/OSC2MIDI.ino index 99f88a7..5aa4111 100644 --- a/OSC2MIDI.ino +++ b/OSC2MIDI.ino @@ -48,6 +48,8 @@ void OSCToMidiCC(OSCMessage &msg, int offset); void OSCMixerMuteToMidiCC(OSCMessage &msg, int offset); void OSCMixerSoloToMidiCC(OSCMessage &msg, int offset); void MidiCCToOSC(uint8_t channel, uint8_t number, uint8_t value); +void ConfigAPWeb(void); + /*void change_midi_state(uint8_t midichannel, uint8_t cc, uint8_t value); void show_midi_state(void); void set_midi_state(void); @@ -148,14 +150,17 @@ void setup() { DEBUG_MSG("Mode Client\n"); + lcd.setCursor(0, 1); + lcd.print(F("Connecting... ")); + WiFiManager wm; - lcd.clear(); - lcd.setCursor(0, 0); - lcd.print(F("Mode Config-AP")); - lcd.setCursor(0, 1); - lcd.print(F("192.168.4.1")); + /* + //called after AP mode and config portal has started + void setAPCallback( std::function func ); + //called after webserver has started */ + wm.setWebServerCallback(ConfigAPWeb); wm.setConnectTimeout(WIFI_CONNECT_TIMEOUT); wm.setConfigPortalTimeout(CFG_PORTAL_TIMEOUT); wm.setBreakAfterConfig(true); @@ -1028,35 +1033,46 @@ void ping(OSCMessage & msg, int offset) broadcast_midistate(); } } +void ConfigAPWeb(void) +{ + lcd.clear(); + lcd.setCursor(0, 0); + lcd.print(F("Mode Config-AP")); + lcd.setCursor(0, 1); + lcd.print(F("192.168.4.1")); +} void listDir(fs::FS & fs, const char * dirname, uint8_t levels) { - Serial.printf("Listing directory : %s\r\n", dirname); + DEBUG_MSG("Listing directory : %s\n", dirname); File root = fs.open(dirname); - if (!root) { - Serial.println(" - failed to open directory"); + if (!root) + { + DEBUG_MSG("* Failed to open directory\n"); return; } - if (!root.isDirectory()) { - Serial.println(" - not a directory"); + if (!root.isDirectory()) + { + DEBUG_MSG("* Not a directory\n"); return; } File file = root.openNextFile(); - while (file) { - if (file.isDirectory()) { - Serial.print(" DIR : "); - Serial.println(file.name()); - if (levels) { + while (file) + { + if (file.isDirectory()) + { + DEBUG_MSG(" DIR: "); + DEBUG_MSG("%s\n", file.name()); + if (levels) + { listDir(fs, file.name(), levels - 1); } - } else { - Serial.print(" FILE : "); - Serial.print(file.name()); - Serial.print("\tSIZE : "); - Serial.println(file.size()); } + else + DEBUG_MSG(" FILE: %s\t\tSIZE: %d\n", file.name(), file.size()); + file = root.openNextFile(); } }