Skip to content

Commit bbb0c7f

Browse files
committed
LP-593 firmwareIAP cleanup, remove code for old AHRS
1 parent 4c83f0a commit bbb0c7f

2 files changed

Lines changed: 8 additions & 30 deletions

File tree

flight/modules/FirmwareIAP/firmwareiap.c

Lines changed: 5 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
******************************************************************************
33
*
44
* @file firmwareiap.c
5-
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
5+
* @author The LibrePilot Project, http://www.librepilot.org Copyright (C) 2018.
6+
* The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
67
* @brief In Application Programming module to support firmware upgrades by
78
* providing a means to enter the bootloader.
89
*
@@ -47,7 +48,7 @@
4748
#define IAP_STATE_STEP_2 2
4849
#define IAP_STATE_RESETTING 3
4950

50-
#define RESET_DELAY 500 /* delay between sending reset ot INS */
51+
#define RESET_DELAY 500
5152

5253
#define TICKS2MS(t) ((t) / portTICK_RATE_MS)
5354
#define MS2TICKS(m) ((m) * portTICK_RATE_MS)
@@ -128,7 +129,6 @@ int32_t FirmwareIAPStart()
128129
static uint8_t iap_state = IAP_STATE_READY;
129130
static void FirmwareIAPCallback(UAVObjEvent *ev)
130131
{
131-
const struct pios_board_info *bdinfo = &pios_board_info_blob;
132132
static uint32_t last_time = 0;
133133
uint32_t this_time;
134134
uint32_t delta;
@@ -138,26 +138,13 @@ static void FirmwareIAPCallback(UAVObjEvent *ev)
138138
}
139139

140140
FirmwareIAPObjData data;
141-
FirmwareIAPObjGet(&data);
142141

143142
if (ev->obj == FirmwareIAPObjHandle()) {
144143
// Get the input object data
145144
FirmwareIAPObjGet(&data);
146145
this_time = get_time();
147146
delta = this_time - last_time;
148147
last_time = this_time;
149-
if ((data.BoardType == bdinfo->board_type) && (data.crc != PIOS_BL_HELPER_CRC_Memory_Calc())) {
150-
PIOS_BL_HELPER_FLASH_Read_Description(data.Description, FIRMWAREIAPOBJ_DESCRIPTION_NUMELEM);
151-
PIOS_SYS_SerialNumberGetBinary(data.CPUSerial);
152-
data.BoardRevision = bdinfo->board_rev;
153-
data.BootloaderRevision = bdinfo->bl_rev;
154-
data.crc = PIOS_BL_HELPER_CRC_Memory_Calc();
155-
FirmwareIAPObjSet(&data);
156-
}
157-
if ((data.ArmReset == 1) && (iap_state != IAP_STATE_RESETTING)) {
158-
data.ArmReset = 0;
159-
FirmwareIAPObjSet(&data);
160-
}
161148
switch (iap_state) {
162149
case IAP_STATE_READY:
163150
if (data.Command == IAP_CMD_STEP_1) {
@@ -240,7 +227,7 @@ static uint32_t get_time(void)
240227
}
241228

242229
/**
243-
* Executed by event dispatcher callback to reset INS before resetting OP
230+
* Executed by event dispatcher callback to reset Board
244231
*/
245232
static void resetTask(__attribute__((unused)) UAVObjEvent *ev)
246233
{
@@ -252,18 +239,8 @@ static void resetTask(__attribute__((unused)) UAVObjEvent *ev)
252239
PIOS_LED_Toggle(PIOS_LED_ALARM);
253240
#endif /* PIOS_LED_ALARM */
254241

255-
FirmwareIAPObjData data;
256-
FirmwareIAPObjGet(&data);
257-
258242
if ((portTickType)(xTaskGetTickCount() - lastResetSysTime) > RESET_DELAY / portTICK_RATE_MS) {
259243
lastResetSysTime = xTaskGetTickCount();
260-
data.BoardType = 0xFF;
261-
data.ArmReset = 1;
262-
data.crc = reset_count; /* Must change a value for this to get to INS */
263-
FirmwareIAPObjSet(&data);
264-
++reset_count;
265-
if (reset_count > 3) {
266-
PIOS_SYS_Reset();
267-
}
244+
PIOS_SYS_Reset();
268245
}
269246
}

flight/modules/FirmwareIAP/inc/firmwareiap.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
/**
22
******************************************************************************
33
*
4-
* @file firmwareiap.c
4+
* @file firmwareiap.h
55
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
6-
* @brief Example module to be used as a template for actual modules.
6+
* @brief In Application Programming module to support firmware upgrades by
7+
* providing a means to enter the bootloader.
78
*
89
* @see The GNU Public License (GPL) Version 3
910
*

0 commit comments

Comments
 (0)