Subversion Repositories FlightCtrl

Rev

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

Rev 1464 Rev 1465
Line 9... Line 9...
9
 
9
 
10
 
10
 
Line 11... Line 11...
11
uint8_t eeprom_neutral_pos[6] EEMEM;
11
uint8_t eeprom_neutral_pos[6] EEMEM;
12
uint16_t eeprom_pwm_limit[6] EEMEM;
12
uint16_t eeprom_pwm_limit[6] EEMEM;
13
 
13
 
14
volatile uint8_t pwm_signal[6];
14
uint8_t pwm_signal[6];
15
volatile uint8_t pwm_neutral_position[6];
15
uint8_t pwm_neutral_position[6];
-
 
16
uint8_t pwm_position[6];
Line 16... Line 17...
16
volatile uint8_t pwm_position[6];
17
uint16_t pwm_limit[6];
Line 17... Line 18...
17
volatile uint16_t pwm_limit[6];
18
uint8_t pwm_active;
Line 59... Line 60...
59
 
60
 
Line 60... Line 61...
60
void pwm_check_active() {
61
void pwm_check_active() {
61
 
62
 
62
        // check if pwm is configured
63
        // check if pwm is configured
63
        pwm_active  = (pwm_limit[0] != 0xffff) ? (1 << SERVO1) : 0;
64
        pwm_active  = (pwm_limit[0] != 0xffff) ? (1 << SERVO1) : 0;
64
        pwm_active |= (pwm_limit[1] != 0xffff) ? (2 << SERVO1) : 0;
65
        pwm_active |= (pwm_limit[1] != 0xffff) ? (1 << SERVO2) : 0;
65
        pwm_active |= (pwm_limit[2] != 0xffff) ? (3 << SERVO1) : 0;
66
        pwm_active |= (pwm_limit[2] != 0xffff) ? (1 << SERVO3) : 0;
66
        pwm_active |= (pwm_limit[3] != 0xffff) ? (4 << SERVO1) : 0;
67
        pwm_active |= (pwm_limit[3] != 0xffff) ? (1 << SERVO4) : 0;
Line 67... Line 68...
67
        pwm_active |= (pwm_limit[4] != 0xffff) ? (5 << SERVO1) : 0;
68
        pwm_active |= (pwm_limit[4] != 0xffff) ? (1 << SERVO5) : 0;
Line 68... Line 69...
68
        pwm_active |= (pwm_limit[5] != 0xffff) ? (6 << SERVO1) : 0;
69
        pwm_active |= (pwm_limit[5] != 0xffff) ? (1 << SERVO6) : 0;
Line 128... Line 129...
128
                blink_counter++;
129
                blink_counter++;
Line 129... Line 130...
129
 
130
 
Line 130... Line 131...
130
                if (pwm_active == 0) { // not configured
131
                if (pwm_active == 0) { // not configured
-
 
132
 
Line 131... Line 133...
131
 
133
                        blink = 50;
Line 132... Line 134...
132
                        blink = 50;
134
                        pwm_status = 1;
133
 
135
 
-
 
136
                } else {
134
                } else {
137
 
135
 
138
                        if (I2C_timeout == 0) { // no i2c signal
-
 
139
                                blink = 0;
-
 
140
                                pwm_status = 2;
-
 
141
                        } else {
-
 
142
                                I2C_timeout--;
136
                        if (I2C_timeout == 0) { // no i2c signal
143
                                if (I2C_timeout == 0) {
-
 
144
                                        set_pwm_neutral();
137
                                blink = 0;
145
                                        set_pwm();
Line 138... Line 146...
138
                        } else {
146
                                }
Line 139... Line 147...
139
                                I2C_timeout--;
147
                                blink = 5;