11,11 → 11,12 |
uint8_t eeprom_neutral_pos[6] EEMEM; |
uint16_t eeprom_pwm_limit[6] EEMEM; |
|
volatile uint8_t pwm_signal[6]; |
volatile uint8_t pwm_neutral_position[6]; |
volatile uint8_t pwm_position[6]; |
volatile uint16_t pwm_limit[6]; |
volatile uint8_t pwm_active; |
uint8_t pwm_signal[6]; |
uint8_t pwm_neutral_position[6]; |
uint8_t pwm_position[6]; |
uint16_t pwm_limit[6]; |
uint8_t pwm_active; |
uint8_t pwm_status = 1; |
|
|
void pwm_init() { |
61,11 → 62,11 |
|
// check if pwm is configured |
pwm_active = (pwm_limit[0] != 0xffff) ? (1 << SERVO1) : 0; |
pwm_active |= (pwm_limit[1] != 0xffff) ? (2 << SERVO1) : 0; |
pwm_active |= (pwm_limit[2] != 0xffff) ? (3 << SERVO1) : 0; |
pwm_active |= (pwm_limit[3] != 0xffff) ? (4 << SERVO1) : 0; |
pwm_active |= (pwm_limit[4] != 0xffff) ? (5 << SERVO1) : 0; |
pwm_active |= (pwm_limit[5] != 0xffff) ? (6 << SERVO1) : 0; |
pwm_active |= (pwm_limit[1] != 0xffff) ? (1 << SERVO2) : 0; |
pwm_active |= (pwm_limit[2] != 0xffff) ? (1 << SERVO3) : 0; |
pwm_active |= (pwm_limit[3] != 0xffff) ? (1 << SERVO4) : 0; |
pwm_active |= (pwm_limit[4] != 0xffff) ? (1 << SERVO5) : 0; |
pwm_active |= (pwm_limit[5] != 0xffff) ? (1 << SERVO6) : 0; |
|
} |
|
130,14 → 131,21 |
if (pwm_active == 0) { // not configured |
|
blink = 50; |
pwm_status = 1; |
|
} else { |
|
if (I2C_timeout == 0) { // no i2c signal |
blink = 0; |
pwm_status = 2; |
} else { |
I2C_timeout--; |
if (I2C_timeout == 0) { |
set_pwm_neutral(); |
set_pwm(); |
} |
blink = 5; |
pwm_status = 0; |
} |
|
} |