1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-02-20 10:54:14 +01:00

LP-593 firmwareIAP cleanup, remove code for old AHRS

This commit is contained in:
Laurent Lalanne 2018-04-12 14:52:12 +02:00
parent 4c83f0a844
commit bbb0c7fb25
2 changed files with 8 additions and 30 deletions

View File

@ -2,7 +2,8 @@
******************************************************************************
*
* @file firmwareiap.c
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @author The LibrePilot Project, http://www.librepilot.org Copyright (C) 2018.
* The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @brief In Application Programming module to support firmware upgrades by
* providing a means to enter the bootloader.
*
@ -47,7 +48,7 @@
#define IAP_STATE_STEP_2 2
#define IAP_STATE_RESETTING 3
#define RESET_DELAY 500 /* delay between sending reset ot INS */
#define RESET_DELAY 500
#define TICKS2MS(t) ((t) / portTICK_RATE_MS)
#define MS2TICKS(m) ((m) * portTICK_RATE_MS)
@ -128,7 +129,6 @@ int32_t FirmwareIAPStart()
static uint8_t iap_state = IAP_STATE_READY;
static void FirmwareIAPCallback(UAVObjEvent *ev)
{
const struct pios_board_info *bdinfo = &pios_board_info_blob;
static uint32_t last_time = 0;
uint32_t this_time;
uint32_t delta;
@ -138,7 +138,6 @@ static void FirmwareIAPCallback(UAVObjEvent *ev)
}
FirmwareIAPObjData data;
FirmwareIAPObjGet(&data);
if (ev->obj == FirmwareIAPObjHandle()) {
// Get the input object data
@ -146,18 +145,6 @@ static void FirmwareIAPCallback(UAVObjEvent *ev)
this_time = get_time();
delta = this_time - last_time;
last_time = this_time;
if ((data.BoardType == bdinfo->board_type) && (data.crc != PIOS_BL_HELPER_CRC_Memory_Calc())) {
PIOS_BL_HELPER_FLASH_Read_Description(data.Description, FIRMWAREIAPOBJ_DESCRIPTION_NUMELEM);
PIOS_SYS_SerialNumberGetBinary(data.CPUSerial);
data.BoardRevision = bdinfo->board_rev;
data.BootloaderRevision = bdinfo->bl_rev;
data.crc = PIOS_BL_HELPER_CRC_Memory_Calc();
FirmwareIAPObjSet(&data);
}
if ((data.ArmReset == 1) && (iap_state != IAP_STATE_RESETTING)) {
data.ArmReset = 0;
FirmwareIAPObjSet(&data);
}
switch (iap_state) {
case IAP_STATE_READY:
if (data.Command == IAP_CMD_STEP_1) {
@ -240,7 +227,7 @@ static uint32_t get_time(void)
}
/**
* Executed by event dispatcher callback to reset INS before resetting OP
* Executed by event dispatcher callback to reset Board
*/
static void resetTask(__attribute__((unused)) UAVObjEvent *ev)
{
@ -252,18 +239,8 @@ static void resetTask(__attribute__((unused)) UAVObjEvent *ev)
PIOS_LED_Toggle(PIOS_LED_ALARM);
#endif /* PIOS_LED_ALARM */
FirmwareIAPObjData data;
FirmwareIAPObjGet(&data);
if ((portTickType)(xTaskGetTickCount() - lastResetSysTime) > RESET_DELAY / portTICK_RATE_MS) {
lastResetSysTime = xTaskGetTickCount();
data.BoardType = 0xFF;
data.ArmReset = 1;
data.crc = reset_count; /* Must change a value for this to get to INS */
FirmwareIAPObjSet(&data);
++reset_count;
if (reset_count > 3) {
PIOS_SYS_Reset();
}
PIOS_SYS_Reset();
}
}

View File

@ -1,9 +1,10 @@
/**
******************************************************************************
*
* @file firmwareiap.c
* @file firmwareiap.h
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @brief Example module to be used as a template for actual modules.
* @brief In Application Programming module to support firmware upgrades by
* providing a means to enter the bootloader.
*
* @see The GNU Public License (GPL) Version 3
*