@@ -189,23 +189,6 @@ void HandleConfigMsg(mspPacket_t *packet)
189189
190190void ProcessMSPPacketFromTX (mspPacket_t *packet)
191191{
192- if (packet->function == MSP_ELRS_BIND)
193- {
194- config.SetGroupAddress (packet->payload );
195- DBG (" MSP_ELRS_BIND = " );
196- for (int i = 0 ; i < 6 ; i++)
197- {
198- DBG (" %x" , packet->payload [i]); // Debug prints
199- DBG (" ," );
200- }
201- DBG (" " ); // Extra line for serial output readability
202- config.Commit ();
203- // delay(500); // delay may not be required
204- sendMSPViaEspnow (packet);
205- // delay(500); // delay may not be required
206- rebootTime = millis (); // restart to set SetSoftMACAddress
207- }
208-
209192 switch (packet->function )
210193 {
211194 case MSP_SET_VTX_CONFIG:
@@ -215,35 +198,63 @@ void ProcessMSPPacketFromTX(mspPacket_t *packet)
215198 // transparently forward MSP packets via espnow to any subscribers
216199 sendMSPViaEspnow (packet);
217200 break ;
201+
218202 case MSP_ELRS_SET_VRX_BACKPACK_WIFI_MODE:
219203 DBGLN (" Processing MSP_ELRS_SET_VRX_BACKPACK_WIFI_MODE..." );
220204 sendMSPViaEspnow (packet);
221205 break ;
206+
222207 case MSP_ELRS_SET_TX_BACKPACK_WIFI_MODE:
223208 DBGLN (" Processing MSP_ELRS_SET_TX_BACKPACK_WIFI_MODE..." );
224209 RebootIntoWifi ();
225210 break ;
211+
226212 case MSP_ELRS_GET_BACKPACK_VERSION:
227213 DBGLN (" Processing MSP_ELRS_GET_BACKPACK_VERSION..." );
228214 SendVersionResponse ();
229215 break ;
216+
230217 case MSP_ELRS_BACKPACK_SET_HEAD_TRACKING:
231218 DBGLN (" Processing MSP_ELRS_BACKPACK_SET_HEAD_TRACKING..." );
232219 cachedHTPacket = *packet;
233220 cacheFull = true ;
234221 sendMSPViaEspnow (packet);
235222 break ;
223+
236224 case MSP_ELRS_BACKPACK_CRSF_TLM:
237225 DBGLN (" Processing MSP_ELRS_BACKPACK_CRSF_TLM..." );
238226 if (config.GetTelemMode () != BACKPACK_TELEM_MODE_OFF)
239227 {
240228 sendMSPViaEspnow (packet);
241229 }
242230 break ;
231+
243232 case MSP_ELRS_BACKPACK_CONFIG:
244233 DBGLN (" Processing MSP_ELRS_BACKPACK_CONFIG..." );
245234 HandleConfigMsg (packet);
246235 break ;
236+
237+ case MSP_ELRS_BIND:
238+ DBG (" MSP_ELRS_BIND = " );
239+ for (int i = 0 ; i < 6 ; i++)
240+ {
241+ DBG (" %x" , packet->payload [i]); // Debug prints
242+ DBG (" ," );
243+ }
244+ DBG (" " ); // Extra line for serial output readability
245+
246+ // If the BIND address is different to our current one,
247+ // then we save it and reboot so it can take effect
248+ if (memcmp (packet->payload , config.GetGroupAddress (), 6 ) != 0 )
249+ {
250+ config.SetGroupAddress (packet->payload );
251+ config.Commit ();
252+ rebootTime = millis (); // restart to set SetSoftMACAddress
253+ return ;
254+ }
255+ sendMSPViaEspnow (packet);
256+ break ;
257+
247258 default :
248259 // transparently forward MSP packets via espnow to any subscribers
249260 sendMSPViaEspnow (packet);
@@ -352,8 +363,8 @@ void setup()
352363 Serial1.begin (115200 );
353364 Serial1.setDebugOutput (true );
354365 #endif
355- Serial.begin (460800 );
356366 Serial.setRxBufferSize (4096 );
367+ Serial.begin (460800 );
357368
358369 options_init ();
359370
0 commit comments