@@ -9,6 +9,9 @@ void menuFirmware()
99 systemPrintln ();
1010 systemPrintln (" Menu: Update Firmware" );
1111
12+ if (btPrintEcho == true )
13+ systemPrintln (" Firmware update not available while configuration over Bluetooth is active" );
14+
1215 char currentVersion[20 ];
1316 if (enableRCFirmware == false )
1417 sprintf (currentVersion, " %d.%d" , FIRMWARE_VERSION_MAJOR, FIRMWARE_VERSION_MINOR);
@@ -43,10 +46,12 @@ void menuFirmware()
4346 incoming--;
4447 updateFromSD (binFileNames[incoming]);
4548 }
46- else if (incoming == ' c' )
49+ else if (incoming == ' c' && btPrintEcho == false )
4750 {
4851 bool previouslyConnected = wifiIsConnected ();
4952
53+ bluetoothStop (); // Stop Bluetooth to allow for SSL on the heap
54+
5055 // Attempt to connect to local WiFi
5156 if (wifiConnect (10000 ) == true )
5257 {
@@ -76,11 +81,55 @@ void menuFirmware()
7681 systemPrintln (" Failed to get version number from server." );
7782 }
7883 }
79- else
80- systemPrintln (" Firmware update failed to connect to WiFi." );
84+ else if (incoming == ' c' && btPrintEcho == false )
85+ {
86+ bool previouslyConnected = wifiIsConnected ();
8187
82- if (previouslyConnected == false )
83- wifiStop ();
88+ bluetoothStop (); // Stop Bluetooth to allow for SSL on the heap
89+
90+ // Attempt to connect to local WiFi
91+ if (wifiConnect (10000 ) == true )
92+ {
93+ // Get firmware version from server
94+ if (otaCheckVersion (reportedVersion, sizeof (reportedVersion)))
95+ {
96+ // We got a version number, now determine if it's newer or not
97+ char currentVersion[20 ];
98+ if (enableRCFirmware == false )
99+ sprintf (currentVersion, " %d.%d" , FIRMWARE_VERSION_MAJOR, FIRMWARE_VERSION_MINOR);
100+ else
101+ sprintf (currentVersion, " %d.%d-%s" , FIRMWARE_VERSION_MAJOR, FIRMWARE_VERSION_MINOR, __DATE__);
102+
103+ if (isReportedVersionNewer (reportedVersion, currentVersion) == true )
104+ {
105+ log_d (" New version detected" );
106+ newOTAFirmwareAvailable = true ;
107+ }
108+ else
109+ {
110+ log_d (" No new firmware available" );
111+ }
112+ }
113+ else
114+ {
115+ // Failed to get version number
116+ systemPrintln (" Failed to get version number from server." );
117+ }
118+ }
119+ else
120+ systemPrintln (" Firmware update failed to connect to WiFi." );
121+
122+ if (previouslyConnected == false )
123+ wifiStop ();
124+
125+ bluetoothStart (); // Restart BT according to settings
126+ }
127+
128+ }
129+ else if (incoming == ' c' && btPrintEcho == true )
130+ {
131+ systemPrintln (" Firmware update not available while configuration over Bluetooth is active" );
132+ delay (2000 );
84133 }
85134 else if (newOTAFirmwareAvailable && incoming == ' u' )
86135 {
0 commit comments