@@ -68,6 +68,7 @@ var mspHelper = (function (gui) {
68
68
color ;
69
69
if ( ! dataHandler . unsupported || dataHandler . unsupported ) switch ( dataHandler . code ) {
70
70
case MSPCodes . MSPV2_INAV_STATUS :
71
+ let profile_changed = false ;
71
72
CONFIG . cycleTime = data . getUint16 ( offset , true ) ;
72
73
offset += 2 ;
73
74
CONFIG . i2cError = data . getUint16 ( offset , true ) ;
@@ -76,19 +77,28 @@ var mspHelper = (function (gui) {
76
77
offset += 2 ;
77
78
CONFIG . cpuload = data . getUint16 ( offset , true ) ;
78
79
offset += 2 ;
80
+
79
81
profile_byte = data . getUint8 ( offset ++ )
80
- CONFIG . profile = profile_byte & 0x0F ;
81
- CONFIG . battery_profile = ( profile_byte & 0xF0 ) >> 4 ;
82
+ let profile = profile_byte & 0x0F ;
83
+ profile_changed |= ( profile !== CONFIG . profile ) && ( CONFIG . profile !== - 1 ) ;
84
+ CONFIG . profile = profile ;
85
+
86
+ let battery_profile = ( profile_byte & 0xF0 ) >> 4 ;
87
+ profile_changed |= ( battery_profile !== CONFIG . battery_profile ) && ( CONFIG . battery_profile !== - 1 ) ;
88
+ CONFIG . battery_profile = battery_profile ;
89
+
82
90
CONFIG . armingFlags = data . getUint32 ( offset , true ) ;
83
91
offset += 4 ;
84
92
85
93
//As there are 8 bytes for mspBoxModeFlags (number of bytes is actually variable)
86
94
//read mixer profile as the last byte in the the message
87
95
profile_byte = data . getUint8 ( dataHandler . message_length_expected - 1 ) ;
88
- CONFIG . mixer_profile = profile_byte & 0x0F ;
96
+ let mixer_profile = profile_byte & 0x0F ;
97
+ profile_changed |= ( mixer_profile !== CONFIG . mixer_profile ) && ( CONFIG . mixer_profile !== - 1 ) ;
98
+ CONFIG . mixer_profile = mixer_profile ;
89
99
90
100
gui . updateStatusBar ( ) ;
91
- gui . updateProfileChange ( ) ;
101
+ gui . updateProfileChange ( profile_changed ) ;
92
102
break ;
93
103
94
104
case MSPCodes . MSP_ACTIVEBOXES :
0 commit comments