Rover::Rover(void) : param_loader(var_info), channel_steer(nullptr), channel_throttle(nullptr), channel_learn(nullptr), DataFlash{FIRMWARE_STRING}, in_log_download(false), modes(&g.mode1), L1_controller(ahrs), nav_controller(&L1_controller), steerController(ahrs), mission(ahrs, FUNCTOR_BIND_MEMBER(&Rover::start_command, bool, const AP_Mission::Mission_Command&), FUNCTOR_BIND_MEMBER(&Rover::verify_command_callback, bool, const AP_Mission::Mission_Command&), FUNCTOR_BIND_MEMBER(&Rover::exit_mission, void)), num_gcs(MAVLINK_COMM_NUM_BUFFERS), ServoRelayEvents(relay), #if CAMERA == ENABLED camera(&relay), #endif #if MOUNT == ENABLED camera_mount(ahrs, current_loc), #endif control_mode(INITIALISING), ground_start_count(20), throttle(500), #if FRSKY_TELEM_ENABLED == ENABLED frsky_telemetry(ahrs, battery, sonar), #endif home(ahrs.get_home()), G_Dt(0.02) { }
Rover::Rover(void) : param_loader(var_info), channel_steer(nullptr), channel_throttle(nullptr), channel_learn(nullptr), DataFlash{FIRMWARE_STRING, g.log_bitmask}, modes(&g.mode1), L1_controller(ahrs, nullptr), nav_controller(&L1_controller), steerController(ahrs), mission(ahrs, FUNCTOR_BIND_MEMBER(&Rover::start_command, bool, const AP_Mission::Mission_Command&), FUNCTOR_BIND_MEMBER(&Rover::verify_command_callback, bool, const AP_Mission::Mission_Command&), FUNCTOR_BIND_MEMBER(&Rover::exit_mission, void)), ServoRelayEvents(relay), #if CAMERA == ENABLED camera(&relay), #endif #if MOUNT == ENABLED camera_mount(ahrs, current_loc), #endif control_mode(INITIALISING), throttle(500), #if FRSKY_TELEM_ENABLED == ENABLED frsky_telemetry(ahrs, battery, rangefinder), #endif do_auto_rotation(false), home(ahrs.get_home()), G_Dt(0.02f) { }
int main (void) { clunet_init(); clunet_set_on_data_received(data_received); time_init(); sei(); //eeprom_write_dword((void*)0, 0); record_num = eeprom_read_dword((void*)0); // Читаем кол-во записей mode_current = eeprom_read_byte((void*)4); // Режим mode_temp = eeprom_read_byte((void*)5); // Временный режим disk_initialize(0); unset_bit(DDRA, 3); set_bit(PORTA, 3); // Определение сигнала в линии //unset_bit(DDRA, 4); unset_bit(PORTA, 4); // Открывалка двери, напрямую set_bit(DDRA, 4); unset_bit(PORTA, 4); // Открывалка двери, через реле set_bit(DDRA, 5); HANGUP; // Реле снимания трубки set_bit(DDRA, 6); MODE_NORMAL; // Реле выбора режима unset_bit(DDRG, 0); set_bit(PORTG, 0); // Определение, лежит ли трубка set_bit(DDRD, 6); set_bit(DDRD, 7); // Светодиоды unset_bit(DDRA, 7); set_bit(PORTA, 7); // Счётчик оборотов диска unset_bit(DDRF, 0); // ADC+ unset_bit(PORTF, 0); unset_bit(DDRF, 1); // ADC- unset_bit(PORTF, 1); beep(500, 200); beep(1500, 200); beep(3000, 200); _delay_ms(1000); if (play_wav_pgm(STARTED_WAV) == 0) { LED_GREEN_ON; while (sound_read() >= 0) ; LED_GREEN_OFF; sound_stop(); } else { LED_RED_ON; beep(3000, 200); beep(1500, 200); beep(500, 200); LED_RED_OFF; } send_current_mode(CLUNET_BROADCAST_ADDRESS); while(1) { if (is_LINE_POWER()) incoming_ring(); if (OFFHOOK) control_mode(); transfer_data(); // Передаём данные на досуге. } }