-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Src: Beacon: Limiting the number of deployment executions
- Loading branch information
Showing
6 changed files
with
29 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,7 +25,7 @@ | |
* | ||
* \author Gabriel Mariano Marcelino <[email protected]> | ||
* | ||
* \version 0.2.15 | ||
* \version 0.2.16 | ||
* | ||
* \date 08/06/2017 | ||
* | ||
|
@@ -145,6 +145,8 @@ | |
|
||
#define BEACON_ANTENNA_INIT_TIMEOUT_MS 100 | ||
|
||
#define BEACON_ANTENNA_MAX_DEPLOYMENTS 10 | ||
|
||
//######################################################## | ||
//-- CPU ------------------------------------------------- | ||
//######################################################## | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,7 +25,7 @@ | |
* | ||
* \author Gabriel Mariano Marcelino <[email protected]> | ||
* | ||
* \version 0.2.11 | ||
* \version 0.2.16 | ||
* | ||
* \date 18/03/2019 | ||
* | ||
|
@@ -60,6 +60,7 @@ | |
#define MEMORY_ADR_PARAM_OBDH_IS_DEAD_PKT (uint8_t *)(FLASH_SEG_D_ADR + 36) | ||
#define MEMORY_ADR_PARAM_PARAMS_SAVED (uint8_t *)(FLASH_SEG_D_ADR + 40) | ||
#define MEMORY_ADR_PARAM_PARAMS_DEPLOU_HIB_EXECUTED (uint8_t *)(FLASH_SEG_D_ADR + 44) | ||
#define MEMORY_ADR_PARAM_DEPLOYMENT_ATTEMPTS (uint8_t *)(FLASH_SEG_D_ADR + 48) | ||
|
||
#endif // MEMORY_H_ | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,7 +25,7 @@ | |
* | ||
* \author Gabriel Mariano Marcelino <[email protected]> | ||
* | ||
* \version 0.2.11 | ||
* \version 0.2.16 | ||
* | ||
* \date 08/06/2017 | ||
* | ||
|
@@ -638,6 +638,18 @@ void beacon_antenna_deployment() | |
{ | ||
debug_print_event_from_module(DEBUG_INFO, BEACON_MODULE_NAME, "Executing the deployment routines...\n\r"); | ||
|
||
if (beacon.deployment_attempts >= BEACON_ANTENNA_MAX_DEPLOYMENTS) | ||
{ | ||
debug_print_event_from_module(DEBUG_WARNING, BEACON_MODULE_NAME, "Enough deployment attempts executed ("); | ||
debug_print_dec(beacon.deployment_attempts); | ||
debug_print_msg(")! Skipping the deployment routine...\n\r"); | ||
|
||
beacon.hibernation = false; | ||
beacon.deployment_executed = true; | ||
|
||
return; | ||
} | ||
|
||
// If it is the first deployment attempt, wait 45 minutes before trying to deploy | ||
if (!beacon.deploy_hibernation_executed) | ||
{ | ||
|
@@ -671,6 +683,8 @@ void beacon_antenna_deployment() | |
|
||
antenna_deploy(); | ||
|
||
beacon.deployment_attempts++; | ||
|
||
beacon.hibernation = false; | ||
beacon.deployment_executed = true; | ||
} | ||
|
@@ -700,6 +714,7 @@ void beacon_load_params() | |
beacon.energy_level = SATELLITE_ENERGY_LEVEL_5; | ||
beacon.deploy_hibernation_executed = false; | ||
beacon.last_energy_level_set = time_get_seconds(); | ||
beacon.deployment_attempts = 0; | ||
|
||
beacon.eps.time_last_valid_pkt = time_get_seconds(); | ||
beacon.eps.errors = 0; | ||
|
@@ -715,6 +730,7 @@ void beacon_load_params() | |
beacon.energy_level = flash_read_single(BEACON_PARAM_ENERGY_LEVEL_MEM_ADR); | ||
beacon.last_energy_level_set = flash_read_long(BEACON_PARAM_LAST_ENERGY_LEVEL_SET_MEM_ADR); | ||
beacon.deploy_hibernation_executed = flash_read_single(BEACON_PARAM_PARAMS_DEPLOU_HIB_EXECUTED_MEM_ADR); | ||
beacon.deployment_attempts = flash_read_single(BEACON_PARAM_DEPLOYMENT_ATTEMPTS_MEM_ADR); | ||
|
||
beacon.eps.time_last_valid_pkt = flash_read_long(BEACON_PARAM_EPS_LAST_TIME_VALID_PKT_MEM_ADR); | ||
beacon.eps.errors = flash_read_single(BEACON_PARAM_EPS_ERRORS_MEM_ADR); | ||
|
@@ -736,6 +752,7 @@ void beacon_save_params() | |
flash_write_single(beacon.energy_level, BEACON_PARAM_ENERGY_LEVEL_MEM_ADR); | ||
flash_write_long(beacon.last_energy_level_set, BEACON_PARAM_LAST_ENERGY_LEVEL_SET_MEM_ADR); | ||
flash_write_single(beacon.deploy_hibernation_executed ? 1 : 0, BEACON_PARAM_PARAMS_DEPLOU_HIB_EXECUTED_MEM_ADR); | ||
flash_write_single(beacon.deployment_attempts, BEACON_PARAM_DEPLOYMENT_ATTEMPTS_MEM_ADR); | ||
|
||
flash_write_long(beacon.eps.time_last_valid_pkt, BEACON_PARAM_EPS_LAST_TIME_VALID_PKT_MEM_ADR); | ||
flash_write_single(beacon.eps.errors, BEACON_PARAM_EPS_ERRORS_MEM_ADR); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,7 +25,7 @@ | |
* | ||
* \author Gabriel Mariano Marcelino <[email protected]> | ||
* | ||
* \version 0.2.11 | ||
* \version 0.2.16 | ||
* | ||
* \date 08/06/2017 | ||
* | ||
|
@@ -55,6 +55,7 @@ typedef struct | |
bool transmitting; /**< If true, the beacon is transmitting packets, otherwise, not. */ | ||
bool deployment_executed; /**< If true, the antenna deployment was executed since the last beacon reset. */ | ||
bool deploy_hibernation_executed; /**< If true, the mandatory deployment hibernation was executed. */ | ||
uint8_t deployment_attempts; /**< Number of executed deployment attempts. */ | ||
uint8_t energy_level; /**< Energy level of the satellite. */ | ||
uint32_t last_radio_reset_time; /**< Time stamp of the last radio reset. */ | ||
uint32_t last_system_reset_time; /**< Time stamp of the last system reset. */ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,7 +25,7 @@ | |
* | ||
* \author Gabriel Mariano Marcelino <[email protected]> | ||
* | ||
* \version 0.2.11 | ||
* \version 0.2.16 | ||
* | ||
* \date 07/03/2019 | ||
* | ||
|
@@ -58,6 +58,7 @@ | |
#define BEACON_PARAM_OBDH_IS_DEAD_PKT_MEM_ADR MEMORY_ADR_PARAM_OBDH_IS_DEAD_PKT | ||
#define BEACON_PARAM_PARAMS_SAVED_MEM_ADR MEMORY_ADR_PARAM_PARAMS_SAVED | ||
#define BEACON_PARAM_PARAMS_DEPLOU_HIB_EXECUTED_MEM_ADR MEMORY_ADR_PARAM_PARAMS_DEPLOU_HIB_EXECUTED | ||
#define BEACON_PARAM_DEPLOYMENT_ATTEMPTS_MEM_ADR MEMORY_ADR_PARAM_DEPLOYMENT_ATTEMPTS | ||
|
||
#endif // BEACON_CONFIG_H_ | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,7 +25,7 @@ | |
* | ||
* \author Gabriel Mariano Marcelino <[email protected]> | ||
* | ||
* \version 0.2.15 | ||
* \version 0.2.16 | ||
* | ||
* \date 08/02/2019 | ||
* | ||
|
@@ -36,7 +36,7 @@ | |
#ifndef VERSION_H_ | ||
#define VERSION_H_ | ||
|
||
#define FIRMWARE_VERSION "0.2.15" | ||
#define FIRMWARE_VERSION "0.2.16" | ||
|
||
#define FIRMWARE_STATUS "Development" | ||
|
||
|