Skip to content

Commit 145c42f

Browse files
committed
Merge branch 'main' into feature/Aaron/ProjectTemplate
2 parents dd3a0c7 + 220ec81 commit 145c42f

44 files changed

Lines changed: 633 additions & 665 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

app/backplane/deployment_module/.idea/deployment.xml

Lines changed: 20 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/backplane/deployment_module/.idea/editor.xml

Lines changed: 213 additions & 462 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/backplane/deployment_module/core.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ CONFIG_CBPRINTF_FP_SUPPORT=y
1111

1212
# OS
1313
CONFIG_POLL=y
14-
CONFIG_MAIN_STACK_SIZE=1024
14+
CONFIG_MAIN_STACK_SIZE=4096
1515
CONFIG_STACK_USAGE=y
1616

1717
CONFIG_TIMESLICING=y

app/backplane/deployment_module/include/c_deployment_module.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,14 @@ class CDeploymentModule : public CProjectConfiguration {
3939
// Devices
4040
CRtc rtc{*DEVICE_DT_GET(DT_ALIAS(rtc))};
4141

42-
std::string ipAddrStr = CREATE_IP_ADDR(NNetworkDefs::DEPLOYMENT_MODULE_IP_ADDR_BASE, 1, CONFIG_MODULE_ID);
42+
std::string ipAddrStr = "10.4.1.1";
4343
const char* sntpServerAddr = "10.2.1.1"; // TODO: Maybe we should look into hostnames? Also, still need to fix the create ip addr bug...
4444

4545
// Tenants
4646
CUdpAlertTenant alertTenant{"Alert Tenant", ipAddrStr.c_str(), NNetworkDefs::ALERT_PORT};
4747

4848
// Tasks
49-
CTask networkTask{"Networking Task", 15, 1024, 0};
49+
CTask networkTask{"Networking Task", 15, 2048, 0};
5050

5151
// Observers
5252
CPyroControlObserver pyroControlObserver;

app/backplane/deployment_module/include/c_pyro_control_observer.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class CPyroControlObserver : public CObserver {
4040
CGpio(GPIO_DT_SPEC_GET(DT_ALIAS(gpio3), gpios))
4141
};
4242

43-
CFlightLog flightLog{"flight.log"};
43+
// CFlightLog flightLog{"flight.log"};
4444
CSoftTimer chargeDisableTimer;
4545

4646
std::array<PyroTrio, 4> pyroTrios{
Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#include "c_pyro_control_observer.h"
22

3+
#include "f_core/os/n_rtos.h"
4+
35
#include <cstdio>
46
#include <f_core/n_alerts.h>
57
#include <zephyr/logging/log.h>
@@ -9,51 +11,59 @@ LOG_MODULE_REGISTER(CPyroControlObserver);
911

1012
static void chargeDisableTimerCallback(k_timer* timer) {
1113
auto* observer = static_cast<CPyroControlObserver*>(timer->user_data);
14+
1215
observer->DisableCallback();
16+
NRtos::ResumeTask("Networking Task");
1317
}
1418

1519
CPyroControlObserver::CPyroControlObserver() {
16-
flightLog.Write("Pyro Controller Observer initialized");
20+
// flightLog.Write("Pyro Controller Observer initialized");
1721
chargeDisableTimer = CSoftTimer(chargeDisableTimerCallback);
1822
chargeDisableTimer.SetUserData(this);
1923
}
2024

2125

2226
void CPyroControlObserver::Notify(void* ctx) {
2327
uint8_t pyroCount = 0;
28+
LOG_INF("Notified");
2429

2530
switch (*static_cast<NAlerts::AlertType*>(ctx)) {
2631
case NAlerts::NOSEOVER:
2732
LOG_INF("Noseover detected. Deploying charges in one second.");
28-
flightLog.Write("Noseover detected. Deploying charges in one second.");
33+
// flightLog.Write("Noseover detected. Deploying charges in one second.");
2934
// TODO: Settings library for handling deployment timing
3035
k_sleep(K_SECONDS(1));
3136

3237
for (auto& [sense, ctrl, led] : pyroTrios) {
33-
if (sense.GetPin() == 1) {
38+
// if (sense.GetPin() == 1) {
3439
ctrl.SetPin(1);
3540
led.SetPin(1);
3641
LOG_INF("Deployed charge %d", pyroCount);
37-
}
42+
// }
3843
pyroCount++;
3944
}
40-
flightLog.Write("Finished deploying charges");
45+
// flightLog.Write("Finished deploying charges");
4146
chargeDisableTimer.StartTimer(3000);
47+
// Must suspend the networking task. If we get a new event, process after we
48+
// process the last one. Otherwise, we can fault during interrupt handling
49+
NRtos::SuspendCurrentTask();
4250
break;
4351
default:
4452
break;
4553
}
4654

47-
flightLog.Sync();
55+
56+
// flightLog.Sync();
4857
}
4958

5059
void CPyroControlObserver::DisableCallback() {
60+
chargeDisableTimer.StopTimer();
5161
int pyroCount = 0;
5262
for (auto& [sense, ctrl, led] : pyroTrios) {
5363
ctrl.SetPin(0);
5464
led.SetPin(0);
5565
LOG_INF("Disabled charge %d", pyroCount);
5666
pyroCount++;
5767
}
58-
flightLog.Write("Finished disabling charges");
68+
// flightLog.Write("Finished disabling charges");
5969
}

app/backplane/deployment_module/src/main.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,14 @@
77

88
#include <f_core/os/n_rtos.h>
99

10+
LOG_MODULE_REGISTER(main);
11+
1012
int main() {
1113
static CDeploymentModule deploymentModule{};
1214

1315
deploymentModule.AddTenantsToTasks();
1416
deploymentModule.AddTasksToRtos();
17+
deploymentModule.SetupCallbacks();
1518

1619
NRtos::StartRtos();
1720

app/backplane/power_module/include/c_power_module.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,8 @@ class CPowerModule : public CProjectConfiguration {
7979
static constexpr int ina219SampleTimeMillis = 69; // 68.1 ms based on our devicetree configuration, and we don't need to sample that quickly
8080

8181
CTask networkTask{"Networking Task", 15, 3072, 0};
82-
CTask sensingTask{"Sensing Task", 15, 1024, ina219SampleTimeMillis};
83-
CTask dataLoggingTask{"Data Logging Task", 15, 1500, 0};
82+
CTask sensingTask{"Sensing Task", 15, 2048, ina219SampleTimeMillis};
83+
CTask dataLoggingTask{"Data Logging Task", 15, 2048, 0};
8484
};
8585

8686

app/backplane/power_module/src/c_sensing_tenant.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ void CSensingTenant::Run() {
8686

8787
if (timer.IsExpired()) {
8888
dataToLog.Send(timestampedData, K_MSEC(5));
89+
NRtos::ResumeTask("Data Logging Task");
8990
}
9091
}
9192

app/backplane/radio_module/core.conf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ CONFIG_F_CORE=y
1010
CONFIG_F_CORE_DEVICE=y
1111
CONFIG_F_CORE_NET=y
1212
CONFIG_F_CORE_RADIO=y
13+
CONFIG_F_CORE_STATE_MACHINE=y
1314
CONFIG_F_CORE_OS=y
1415
CONFIG_F_CORE_UTILS=y
1516

0 commit comments

Comments
 (0)