Subversion Repositories FlightCtrl

Rev

Rev 2443 | Rev 2528 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2443 Rev 2473
Line 105... Line 105...
105
                // determine sum of all present BL currents and setpoints
105
                // determine sum of all present BL currents and setpoints
106
                Current = 0;
106
                Current = 0;
107
                SetSum = 0;
107
                SetSum = 0;
108
                NumOfMotors = 0;
108
                NumOfMotors = 0;
109
                MinOfMaxPWM = 255;
109
                MinOfMaxPWM = 255;
110
                if(Capacity.MinOfMaxPWM == 254) RedundanceBlOperation = 1;
110
                if(Capacity.MinOfMaxPWM == 254)                 FC_StatusFlags3 |= FC_STATUS3_REDUNDANCE;
111
                else if(Capacity.MinOfMaxPWM == 255) RedundanceBlOperation = 0;
111
                else if(Capacity.MinOfMaxPWM == 255)    FC_StatusFlags3 &= ~FC_STATUS3_REDUNDANCE;
Line 112... Line 112...
112
               
112
               
113
                for(i = 0; i < MAX_MOTORS; i++)
113
                for(i = 0; i < MAX_MOTORS; i++)
114
                {
114
                {
115
                        if(Motor[i].State & MOTOR_STATE_PRESENT_MASK/* && Mixer.Motor[i][MIX_GAS]*/)
115
                        if(Motor[i].State & MOTOR_STATE_PRESENT_MASK/* && Mixer.Motor[i][MIX_GAS]*/)
Line 119... Line 119...
119
                                 {
119
                                 {
120
                                  Current += BL3_Current(i); // extended Current measurement -> 200 = 20A    201 = 21A    255 = 75A (20+55)
120
                                  Current += BL3_Current(i); // extended Current measurement -> 200 = 20A    201 = 21A    255 = 75A (20+55)
121
                                 }
121
                                 }
122
                                 else Current += (unsigned int)(Motor[i].Current);
122
                                 else Current += (unsigned int)(Motor[i].Current);
123
                                SetSum +=  (unsigned int)(Motor[i].SetPoint);
123
                                SetSum +=  (unsigned int)(Motor[i].SetPoint);
124
                                if(Motor[i].MaxPWM <= MinOfMaxPWM) MinOfMaxPWM = Motor[i].MaxPWM; else RedundanceBlOperation = 0;
124
                                if(Motor[i].MaxPWM <= MinOfMaxPWM) MinOfMaxPWM = Motor[i].MaxPWM; else FC_StatusFlags3 &= ~FC_STATUS3_REDUNDANCE;
125
                        }
125
                        }
126
                }
126
                }
127
                Capacity.MinOfMaxPWM = MinOfMaxPWM;
127
                Capacity.MinOfMaxPWM = MinOfMaxPWM;
128
                if(SetSum == 0) // if all setpoints are 0
128
                if(SetSum == 0) // if all setpoints are 0
129
                { // determine offsets of motor currents
129
                { // determine offsets of motor currents