Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changes Uploaded during RC8 #212

Merged
merged 22 commits into from
Apr 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
19b02b9
refactoring --everything-- to ignore the cameras and will add functio…
iris-hermes-mobile Mar 11, 2023
0943d50
got 0's and 1's on gnd for 500x500 grid. it didn't like 1500x1000, pr…
iris-hermes-mobile Mar 11, 2023
6f0db07
GI: Hacky patch to make sure file downlinks from GI don't swamp the W…
iris-hermes-mobile Mar 12, 2023
90cb7e5
GI: Fixed packing issue with FileMetadata and FileHeader
iris-hermes-mobile Mar 12, 2023
6a6be48
Other half of hacky patch to make sure file downlinks from GI don't s…
iris-hermes-mobile Mar 12, 2023
87e87f7
CAM: IMPORTANT adding time port to Camera.
iris-hermes-mobile Mar 12, 2023
a6e04a7
GDS: Patch to sync FSW working branch file encoding with GDS.
iris-hermes-mobile Mar 13, 2023
26a4660
NI: Changes to NetworkInterface TX SM handler to flush udp and preven…
iris-hermes-mobile Mar 13, 2023
241e493
NI: IMG DL WORKS!
iris-hermes-mobile Mar 13, 2023
f275b54
WF121: Hercules awaitResponse timeout decreased to less than ilock pe…
iris-hermes-mobile Mar 13, 2023
74b556e
WD: Added working Hercules Kick Monitoring (auto-reset) and defaulted…
iris-hermes-mobile Mar 13, 2023
7903129
WD: Improved WD auto-reset behavior.
iris-hermes-mobile Mar 13, 2023
f60de03
WD: Added mode for flashing Hercules.
iris-hermes-mobile Mar 13, 2023
8ffb1fc
CAM: Made test grid a mild gradient.
iris-hermes-mobile Mar 13, 2023
f9a2e00
NI: Added ILOCK fetch before each packet send. This seems to be the w…
iris-hermes-mobile Mar 13, 2023
6d29b65
NI: Removed pre-chunk ILOCK request (improved radio stability -- seem…
iris-hermes-mobile Mar 14, 2023
5904dd3
GDS: Added command aliases for testing UDP buffer flushing on the rad…
iris-hermes-mobile Mar 14, 2023
310eedf
NI: Final SM upgrades to improve ILOCK loss handling.
iris-hermes-mobile Mar 14, 2023
76741c5
FSW: Bump semver to indicate NI 'works' (is able to downlink image).
iris-hermes-mobile Mar 14, 2023
d984e07
RC8: CAM+WIFI works (recon weird though).
iris-hermes-mobile Mar 14, 2023
9b1b5ad
WD: Tweaker heater control settings in response to iTVAC.
iris-hermes-mobile Mar 14, 2023
1a17c60
RC8: Added binaries.
iris-hermes-mobile Apr 5, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
79 changes: 40 additions & 39 deletions Apps/FlightSoftware/PrimaryFlightController/FlightMCU/.cproject

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,13 @@ struct FswFileHeader {
uint8_t totalBlocks;
uint8_t blockNumber; // This is 1-indexed, 0-index is optional and contains file-specific metadata
FileLength_t length; // This is the size of the following data **not including this header**
};
} __attribute__((packed));

struct FswFileMetadata { // Block 0 of files
uint16_t callbackId;
uint32_t timestamp;
};
} __attribute__((packed));


struct FswFile {
struct FswFileHeader header;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
*****************************************************************************/

static const unsigned VERSION_MAJOR = 8; // Version: ++ when drafting a new Release Candidate (for a new upload opportunity)
static const unsigned VERSION_MINOR = 0; // Subversion: ++ when a new major feature has been added / made to work
static const unsigned VERSION_MINOR = 1; // Subversion: ++ when a new major feature has been added / made to work
static const unsigned VERSION_REVISION = 0; // Patch: ++ when you make a change and want to reflect that.

#endif // _VERSION_H_
112 changes: 111 additions & 1 deletion Apps/FlightSoftware/Watchdog/.cproject

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions Apps/FlightSoftware/Watchdog/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ doc/
/Debug__opt_for_speed__4/
/Debug_with_flag/
/Debug_Radio_Flashing/
/Debug_Radio_Herc_Flashing/
10 changes: 5 additions & 5 deletions Apps/FlightSoftware/Watchdog/include/flags.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,13 @@ extern "C"
#define DEFAULT_PWM_LIMIT 9999 // deprecated
#define DEFAULT_HEATER_SETPOINT 3325 // deprecated
#define DEFAULT_HEATER_WINDOW 60 // deprecated
// 3670 is the -5 deg C thermistor voltage ADC reading - heater transitions to ON when T ADC < this value:
#define DEFAULT_HEATER_ON_VAL 2781
// 3670 is the 0 deg C thermistor voltage ADC reading - heater transitions to OFF when T ADC > this value:
#define DEFAULT_HEATER_OFF_VAL 2291
// 2540 is the 0 deg C thermistor voltage ADC reading - heater transitions to ON when T ADC < this value:
#define DEFAULT_HEATER_ON_VAL 2540
// 2042 is the 10 deg C thermistor voltage ADC reading - heater transitions to OFF when T ADC > this value:
#define DEFAULT_HEATER_OFF_VAL 2040
#define DEFAULT_HEATING_CONTROL_ENABLED TRUE
#define DEFAULT_HEATER_DUTY_CYCLE_PERIOD 10000
#define DEFAULT_HEATER_DUTY_CYCLE 8500
#define DEFAULT_HEATER_DUTY_CYCLE 9998

#define GENERIC_BIT_INDEX_TO_TYPE_MASK(type, index) (((type)1) << ((type)(index)))
#define GENERIC_BIT_INDEX_TO_UINT8_MASK(index) GENERIC_BIT_INDEX_TO_TYPE_MASK(uint8_t, index)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

#include <cassert>

#include "comms/debug_comms.h"
#include "drivers/bsp.h"

namespace iris
Expand Down Expand Up @@ -43,6 +44,9 @@ namespace iris
{
*(theContext.m_persistentInMission) = false;

DPRINTF("Defaulting MONITOR_HERCULES to OFF in SERVICE.");
theContext.m_watchdogOpts &= ~WDOPT_MONITOR_HERCULES; // don't monitor Hercules for aliveness by default in service

// Enable the falling edge interrupt for WD_INT (should be done after unlocking LOCKLPM5 per slau367p section 12.3.2)
enableWdIntFallingEdgeInterrupt();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,13 @@ namespace iris
DebugComms__tryPrintfToLanderNonblocking("[WARNING] WD SW is in Radio-Programming Mode. This should be changed before flight.\n");
#endif

#ifdef HERC_PROGRAMMING_MODE
// [CWC-03/13/2023] Warn that this is the WRONG version of the SW for Flight and should only be used for hercules programming.
// Essentially this is a special version of the SW that disable hercules monitioring by default in mission (instead of enables) so
// hercules can be programmed. In flight, though, we want Hercules monitoring to be on by default.
DebugComms__tryPrintfToLanderNonblocking("[WARNING] WD SW is in Hercules-Programming Mode. This should be changed before flight.\n");
#endif

/* set up watchdog */
watchdog_init(&(theContext.m_watchdogFlags),
Time__getPointerToCentisecondCount(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,17 @@ namespace iris
disableHeater();
}

#ifdef HERC_PROGRAMMING_MODE
// [CWC-03/13/2023] Warn that this is the WRONG version of the SW for Flight and should only be used for hercules programming.
// Essentially this is a special version of the SW that disable hercules monitioring by default in mission (instead of enables) so
// hercules can be programmed. In flight, though, we want Hercules monitoring to be on by default.
DPRINTF("Defaulting MONITOR_HERCULES to OFF in MISSION for programming.");
theContext.m_watchdogOpts &= ~WDOPT_MONITOR_HERCULES;
#else
DPRINTF("Defaulting MONITOR_HERCULES to ON in MISSION.");
theContext.m_watchdogOpts |= WDOPT_MONITOR_HERCULES; // default to monitoring Hercules for aliveness
#endif

return getState();
}

Expand Down
56 changes: 39 additions & 17 deletions Apps/FlightSoftware/Watchdog/src/watchdog.c
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,14 @@ int watchdog_monitor(HerculesComms__State *hState,
DEBUG_LOG_NULL_CHECK_RETURN(writeIOExpander, "Parameter is NULL", -1);
DEBUG_LOG_NULL_CHECK_RETURN(details, "Parameter is NULL", -1);

// Quick and dirty parameters for tuning Hercules Monitoring:
// How many consequtive kicks has hercules missed since being reset:
static uint8_t herc_conseq_missed_kicks_since_reset = 0;
// How many consequtive missed kicks until a reset (testing has shown it has to be at least 2):
// -- setting this too low won't give Hercules time to reboot after a crash and reset before
// being reset again...
static const uint8_t HERC_CONSEQ_MISSED_KICK_THRESHOLD = 3;

/* temporarily disable interrupts */
__disable_interrupt();

Expand Down Expand Up @@ -206,6 +214,7 @@ int watchdog_monitor(HerculesComms__State *hState,
*watchdogFlags ^= WDFLAG_UNRESET_HERCULES;
*writeIOExpander = TRUE;
SET_RABI_IN_UINT(details->m_resetActionBits, RABI__HERCULES_UNRESET);
DPRINTF("Unreset Hercules.");
}

/* unreset motor 1 */
Expand Down Expand Up @@ -276,29 +285,42 @@ int watchdog_monitor(HerculesComms__State *hState,
if (*watchdogFlags & WDFLAG_HERCULES_KICK)
{
*watchdogFlags ^= WDFLAG_HERCULES_KICK;
herc_conseq_missed_kicks_since_reset = 0;
// Let Ground know Hercules is still alive
// (if Hercules was rebooted while our comms were only over Wifi,
// we wouldn't know when it would be good to send SWITCH TO WIFI MODE).
DPRINTF("Hercules Alive.");
}
else
{
if (*watchdogOpts & WDOPT_MONITOR_HERCULES)
{
// reset the hercules
setHerculesReset();

SET_RABI_IN_UINT(details->m_resetActionBits, RABI__HERCULES_WATCHDOG_RESET);

// Set the flag so that the next time this function triggers, the Hercules will be un-reset
*watchdogFlags |= WDFLAG_UNRESET_HERCULES;

// if the issue was due to a comms breakdown, reset the comms state
if (NULL != hState)
{
HerculesComms__Status hcStatus = HerculesComms__resetState(hState);

//!< @todo Replace with returning watchdog error code once that is implemented.
DEBUG_ASSERT_EQUAL(HERCULES_COMMS__STATUS__SUCCESS, hcStatus);
// Only inc. counter if Herc is being monitored.
herc_conseq_missed_kicks_since_reset += 1;
DPRINTF("Hercules Unresponsive.");
// Only reset if counter too big:
if(herc_conseq_missed_kicks_since_reset >= HERC_CONSEQ_MISSED_KICK_THRESHOLD){
// reset the hercules
DPRINTF("No Hercules Kick. Resetting Hercules . . .");
herc_conseq_missed_kicks_since_reset = 0;
setHerculesReset();

// queue up hercules unreset
*watchdogFlags |= WDFLAG_UNRESET_HERCULES;
SET_RABI_IN_UINT(details->m_resetActionBits, RABI__HERCULES_WATCHDOG_RESET);

// if the issue was due to a comms breakdown, reset the comms state
if (NULL != hState)
{
DPRINTF("\t Resetting Hercules Comms . . .");
HerculesComms__Status hcStatus = HerculesComms__resetState(hState);

//!< @todo Replace with returning watchdog error code once that is implemented.
DEBUG_ASSERT_EQUAL(HERCULES_COMMS__STATUS__SUCCESS, hcStatus);
}

*writeIOExpander = TRUE;
}

*writeIOExpander = TRUE;
}
else
{
Expand Down
Loading