Sunteți pe pagina 1din 2

C:\Users\Simtiger\Downloads\ANDREWUAV\Arduplane2.32...2.32\ArduPlane2.32\libraries\Waypoints\Waypoints.cpp1 /* */ #include"Waypoints.h" Waypoints::Waypoints() { } void Waypoints::set_waypoint_with_index(Waypoints::WPwp,uint8_ti) { i=constrain(i,0,_total); uint32_tmem=_start_byte+(i*_wp_size); } eeprom_busy_wait(); eeprom_write_byte((uint8_t*)mem,wp.id); mem++; eeprom_busy_wait(); eeprom_write_byte((uint8_t*)mem,wp.p1); mem++; eeprom_busy_wait(); eeprom_write_dword((uint32_t*)mem,wp.

word((uint32_t*)mem,wp.alt); mem+=4; eeprom_busy_wait(); eeprom_write_dword((uint32_t*)mem,wp.lat); mem+=4; eeprom_busy_wait(); eeprom_write_dword((uint32_t*)mem,wp.lng); AP_Radio.cppRadiolibraryforArduino CodebyJasonShort.DIYDrones.com Thislibraryisfreesoftware;youcanredistributeitand/or modifyitunderthetermsoftheGNULesserGeneralPublic LicenseaspublishedbytheFreeSoftwareFoundation;either version2.1oftheLicense,or(atyouroption)anylaterversion.

Waypoints::WP Waypoints::get_waypoint_with_index(uint8_ti) { Waypoints::WPwp; i=constrain(i,0,_total); uint32_tmem=_start_byte+(i*_wp_size); eeprom_busy_wait(); wp.id=eeprom_read_byte((uint8_t*)mem); mem++; eeprom_busy_wait(); wp.p1=eeprom_read_byte((uint8_t*)mem); mem++; eeprom_busy_wait(); wp.alt=(long)eeprom_read_dword((uint32_t*)mem); mem+=4; eeprom_busy_wait(); wp.lat=(long)eeprom_read_dword((uint32_t*)mem); mem+=4; eeprom_busy_wait();

C:\Users\Simtiger\Downloads\ANDREWUAV\Arduplane2.32...2.32\ArduPlane2.32\libraries\Waypoints\Waypoints.cpp2 } wp.lng=(long)eeprom_read_dword((uint32_t*)mem);

Waypoints::WP Waypoints::get_current_waypoint(void) { returnget_waypoint_with_index(_index); } uint8_t Waypoints::get_index(void) { return_index; } void Waypoints::next_index(void) { _index++; if(_index>=_total) _index==0; } void Waypoints::set_index(uint8_ti) { i=constrain(i,0,_total); } uint8_t Waypoints::get_total(void) { return_total; } void Waypoints::set_total(uint8_ttotal) { _total=total; } void Waypoints::set_start_byte(uint16_tstart_byte) { _start_byte=start_byte; } void Waypoints::set_wp_size(uint8_twp_size) { _wp_size=wp_size; }

S-ar putea să vă placă și