@ -32,24 +32,24 @@ static struct Location get_cmd_with_index(int i)
@@ -32,24 +32,24 @@ static struct Location get_cmd_with_index(int i)
}else{
// we can load a command, we don't process it yet
// read WP position
uintptr _t mem = (WP_START_BYTE) + (i * WP_SIZE);
uint16 _t mem = (WP_START_BYTE) + (i * WP_SIZE);
temp.id = eeprom_read_byte((uint8_t*) mem);
temp.id = hal.storage->read_byte( mem);
mem++;
temp.options = eeprom_read_byte((uint8_t*) mem);
temp.options = hal.storage->read_byte( mem);
mem++;
temp.p1 = eeprom_read_byte((uint8_t*) mem);
temp.p1 = hal.storage->read_byte( mem);
mem++;
temp.alt = eeprom_read_dword((uint32_t*) mem); // alt is stored in CM! Alt is stored relative!
temp.alt = hal.storage->read_dword( mem); // alt is stored in CM! Alt is stored relative!
mem += 4;
temp.lat = eeprom_read_dword((uint32_t*) mem); // lat is stored in decimal * 10,000,000
temp.lat = hal.storage->read_dword( mem); // lat is stored in decimal * 10,000,000
mem += 4;
temp.lng = eeprom_read_dword((uint32_t*) mem); // lon is stored in decimal * 10,000,000
temp.lng = hal.storage->read_dword( mem); // lon is stored in decimal * 10,000,000
}
// Add on home altitude if we are a nav command (or other command with altitude) and stored alt is relative
@ -81,24 +81,24 @@ static void set_cmd_with_index(struct Location temp, int i)
@@ -81,24 +81,24 @@ static void set_cmd_with_index(struct Location temp, int i)
temp.id = MAV_CMD_NAV_WAYPOINT;
}
uintptr _t mem = WP_START_BYTE + (i * WP_SIZE);
uint16 _t mem = WP_START_BYTE + (i * WP_SIZE);
eeprom_write_byte((uint8_t *) mem, temp.id);
hal.storage->write_byte( mem, temp.id);
mem++;
eeprom_write_byte((uint8_t *) mem, temp.options);
hal.storage->write_byte( mem, temp.options);
mem++;
eeprom_write_byte((uint8_t *) mem, temp.p1);
hal.storage->write_byte( mem, temp.p1);
mem++;
eeprom_write_dword((uint32_t *) mem, temp.alt); // Alt is stored in CM!
hal.storage->write_dword( mem, temp.alt); // Alt is stored in CM!
mem += 4;
eeprom_write_dword((uint32_t *) mem, temp.lat); // Lat is stored in decimal degrees * 10^7
hal.storage->write_dword( mem, temp.lat); // Lat is stored in decimal degrees * 10^7
mem += 4;
eeprom_write_dword((uint32_t *) mem, temp.lng); // Long is stored in decimal degrees * 10^7
hal.storage->write_dword( mem, temp.lng); // Long is stored in decimal degrees * 10^7
// Make sure our WP_total
if(g.command_total < (i+1))