Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
8fc61e3
Added basic read function for logger
Angeraa May 31, 2025
ce15dda
working read function
Angeraa Jun 1, 2025
9dcb5b5
read function param change, name change, and return value change
Angeraa Jun 7, 2025
176a8b4
find, read, write
avancruy Jun 26, 2025
600abd3
Config interface file
avancruy Jul 1, 2025
8215133
TextIO iface and fatfs sd card wrapper driver
Angeraa Jul 5, 2025
c693975
Minor textio class fix, constructor is when file is declared
Angeraa Jul 7, 2025
fb78e6c
Added tell to textio to return current position
Angeraa Jul 7, 2025
6020007
Added eof function for textio
Angeraa Jul 7, 2025
143a328
Added config class
Angeraa Jul 8, 2025
191eabe
Logger now in ZP Core, added SystemUtils drivers, edited model creati…
avancruy Jul 15, 2025
649c07f
moved config to zp core
Angeraa Jul 20, 2025
3e35dcd
Added textIO to Config
avancruy Sep 14, 2025
87b0ee2
Added message queues and handlers for sm and am. They will need to be…
Angeraa Sep 24, 2025
5ee8288
Merge branch 'main' into feature/drivers/sd-paramaterization
Angeraa Oct 11, 2025
ce9682d
Made config use existing SDIO object
Angeraa Oct 11, 2025
fd420fa
fixed broken import
Angeraa Oct 11, 2025
7c0c2a0
Fixed some import issues and some merge conflict issues
Angeraa Oct 11, 2025
70ed745
Added config.cpp to common.cmake and moved config_utils to be with co…
Angeraa Oct 11, 2025
4c4d5a1
Added new param creation, config_defines
avancruy Oct 15, 2025
dbdeee2
Added messeges from TM to SM for param list request and setting param…
Angeraa Nov 1, 2025
80fb2c6
Minor fixes after pulling an old commit
Angeraa Nov 1, 2025
765f438
Logger textIO syntax fix
avancruy Nov 9, 2025
559f092
Fixed build errors
Angeraa Nov 9, 2025
bfb1a36
Added log message to AM handleConfigChange and added it to the AM loop
Angeraa Nov 9, 2025
f9feca9
Comments
Angeraa Jan 17, 2026
b7ddac5
Minor static cast removals that I missed
Angeraa Jan 28, 2026
7e78ee8
Merge branch 'main' into feature/drivers/sd-paramaterization
Angeraa Jan 28, 2026
3369983
Some build fixes and old logger file removal from merge
Angeraa Jan 28, 2026
03b8c57
constructor parameter reorder
avancruy Feb 2, 2026
5db7126
RFD driver startRecieve call plus buffer size change
Angeraa Feb 2, 2026
546095c
Minor changes to the test data and comment removal
Angeraa Feb 2, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion stm32h753iitx/boardfiles/model/src/drivers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ void initDrivers()
// Core utilities
systemUtilsHandle = new (&systemUtilsStorage) SystemUtils();
iwdgHandle = new (&iwdgStorage) IndependentWatchdog(&hiwdg1);
loggerHandle = new (&loggerStorage) Logger(); // Initialized later in RTOS task

// Motors
leftAileronMotorHandle = new (&leftAileronMotorStorage) MotorControl(&htim1, TIM_CHANNEL_1, 5, 10);
Expand Down
241 changes: 238 additions & 3 deletions stm32l552xx/.cproject

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion stm32l552xx/FATFS/Target/user_diskio.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
/* USER CODE BEGIN DECL */

/* Includes ------------------------------------------------------------------*/
#include "logger_config.h"
#include "user_diskio.h"
#include "user_diskio_sdmmc.h"
#include "user_diskio_spi.h"
Expand Down
6 changes: 3 additions & 3 deletions stm32l552xx/FATFS/Target/user_diskio.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@
/* USER CODE BEGIN 0 */

/* Includes ------------------------------------------------------------------*/
#include "logger_config.h"
//#include "logger_params.h"
#include "ff_gen_drv.h"
/* Exported types ------------------------------------------------------------*/
/* Exported constants --------------------------------------------------------*/
/* Exported functions ------------------------------------------------------- */

#ifdef SD_CARD_LOGGING
//#ifdef SD_CARD_LOGGING

//#define SDMMC_INTERFACE
#define SPI_INTERFACE
Expand All @@ -46,7 +46,7 @@
#error Define a SD Card interface
#endif

#endif
//#endif

extern Diskio_drvTypeDef USER_Driver;

Expand Down
84 changes: 0 additions & 84 deletions stm32l552xx/boardfiles/drivers/logger/logger.cpp

This file was deleted.

35 changes: 0 additions & 35 deletions stm32l552xx/boardfiles/drivers/logger/logger.hpp

This file was deleted.

10 changes: 0 additions & 10 deletions stm32l552xx/boardfiles/drivers/logger/logger_config.h

This file was deleted.

1 change: 1 addition & 0 deletions stm32l552xx/boardfiles/drivers/rfd/rfd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ uint16_t RFD::receive(uint8_t* buffer, uint16_t bufferSize) {

void RFD::receiveCallback(uint16_t size){
writeIndex = size;
HAL_UARTEx_ReceiveToIdle_DMA(huart, rxBuffer, BUFFER_SIZE);
}

UART_HandleTypeDef* RFD::getHuart() const {
Expand Down
56 changes: 56 additions & 0 deletions stm32l552xx/boardfiles/drivers/textIo/SDIO.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#include "SDIO.hpp"
#include <cstring>

SDIO::SDIO() {
//blank
}

int SDIO::mountFile() {
return f_mount(&FatFs, "", 1);
}

int SDIO::open(char *file, int modes) {
if (f_open(&fil, file, modes) != FR_OK) {
return 1; // Error opening file
}
return 0; // Success
}

int SDIO::close() {
if (f_close(&fil) != FR_OK) {
return 1; // Error closing file
}
return 0; // Success
}

char* SDIO::read(char *buffer, int bufferSize) {
return f_gets(buffer, bufferSize, &fil); // Reads a line from the file into the buffer
}

int SDIO::write(const char *buffer) {
return f_puts(buffer, &fil); // Writes a string to the file
}

int SDIO::seek(int offset) {
if (f_lseek(&fil, offset) != 0) {
return 1; // Error seeking in file
}
return 0; // Success
}

uint64_t SDIO::fsize() {
return f_size(&fil);
}

uint64_t SDIO::tell() {
return f_tell(&fil); // Returns the current position in the file
}

int SDIO::eof() {
return f_eof(&fil); // Returns whether the end of file has been reached
}

bool SDIO::checkFileExist(char *file) {
FILINFO fno;
return (f_stat(file, &fno) == FR_OK);
}
23 changes: 23 additions & 0 deletions stm32l552xx/boardfiles/drivers/textIo/SDIO.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#pragma once

#include "textio_iface.hpp"
#include "app_fatfs.h"

class SDIO : public ITextIO {
public:
SDIO();
int mountFile() override;
int open(char *file, int modes) override;
int close() override;
char* read(char *buffer, int bufferSize) override;
int write(const char *buffer) override;
int seek(int offset) override;
uint64_t fsize() override;
uint64_t tell() override;
int eof() override;
bool checkFileExist(char *file) override;

private:
FATFS FatFs;
FIL fil;
};
7 changes: 7 additions & 0 deletions stm32l552xx/boardfiles/model/inc/drivers.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
#include "rc.hpp"
#include "rc_crsf.hpp"
#include "rc_motor_control.hpp"
#include "config_keys.hpp"
#include "config_msg.hpp"
#include "SDIO.hpp"
#include "tm_queue.hpp"
#include "mavlink.h"
#include "queue.hpp"
Expand All @@ -19,6 +22,7 @@
extern SystemUtils *systemUtilsHandle;

extern IndependentWatchdog *iwdgHandle;
extern SDIO *textIOHandle;
extern Logger *loggerHandle;

extern MotorControl *leftAileronMotorHandle;
Expand All @@ -38,7 +42,10 @@ extern PowerModule *pmHandle;

extern MessageQueue<RCMotorControlMessage_t> *amRCQueueHandle;
extern MessageQueue<char[100]> *smLoggerQueueHandle;
extern MessageQueue<ConfigMessage_t> *smConfigAttitudeQueueHandle;
extern IMessageQueue<ConfigMessage_t> *smConfigRouteQueueHandle[static_cast<size_t>(Owner_e::COUNT)];
extern MessageQueue<TMMessage_t> *tmQueueHandle;
extern MessageQueue<TMSMMessage_t> *tmSmQueueHandle;
extern MessageQueue<mavlink_message_t> *messageBufferHandle;

extern MotorGroupInstance_t rollMotors;
Expand Down
14 changes: 13 additions & 1 deletion stm32l552xx/boardfiles/model/src/drivers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ alignas(MessageQueue<mavlink_message_t>) static uint8_t messageBufferStorage[siz
// ----------------------------------------------------------------------------
SystemUtils *systemUtilsHandle = nullptr;
IndependentWatchdog *iwdgHandle = nullptr;
SDIO *textIOHandle = nullptr;
Logger *loggerHandle = nullptr;

MotorControl *leftAileronMotorHandle = nullptr;
Expand All @@ -64,7 +65,10 @@ PowerModule *pmHandle = nullptr;

MessageQueue<RCMotorControlMessage_t> *amRCQueueHandle = nullptr;
MessageQueue<char[100]> *smLoggerQueueHandle = nullptr;
IMessageQueue<ConfigMessage_t> *smConfigRouteQueueHandle[static_cast<size_t>(Owner_e::COUNT)] = {};
MessageQueue<ConfigMessage_t> *smConfigAttitudeQueueHandle = nullptr;
MessageQueue<TMMessage_t> *tmQueueHandle = nullptr;
MessageQueue<TMSMMessage_t> *tmSmQueueHandle = nullptr;
MessageQueue<mavlink_message_t> *messageBufferHandle = nullptr;

// ----------------------------------------------------------------------------
Expand Down Expand Up @@ -97,7 +101,8 @@ void initDrivers()
// Core utilities
systemUtilsHandle = new (&systemUtilsStorage) SystemUtils();
iwdgHandle = new (&iwdgStorage) IndependentWatchdog(&hiwdg);
loggerHandle = new (&loggerStorage) Logger(); // Initialized later in RTOS task
textIOHandle = new SDIO();
loggerHandle = new (&loggerStorage) Logger(textIOHandle, systemUtilsHandle); // Initialized later in RTOS task

// Motors
leftAileronMotorHandle = new (&leftAileronMotorStorage) MotorControl(&htim3, TIM_CHANNEL_1, 5, 10);
Expand All @@ -119,7 +124,13 @@ void initDrivers()
// Queues
amRCQueueHandle = new (&amRCQueueStorage) MessageQueue<RCMotorControlMessage_t>(&amQueueId);
smLoggerQueueHandle = new (&smLoggerQueueStorage) MessageQueue<char[100]>(&smLoggerQueueId);
smConfigAttitudeQueueHandle = new MessageQueue<ConfigMessage_t>(&smConfigAttitudeQueueId);
smConfigRouteQueueHandle[static_cast<size_t>(Owner_e::ATTITUDE_MANAGER)] = smConfigAttitudeQueueHandle;
// Add other manager queues to smConfigRouteQueueHandle as needed

loggerHandle->init();
tmQueueHandle = new (&tmQueueStorage) MessageQueue<TMMessage_t>(&tmQueueId);
tmSmQueueHandle = new MessageQueue<TMSMMessage_t>(&tmSmQueueId);
messageBufferHandle = new (&messageBufferStorage) MessageQueue<mavlink_message_t>(&messageBufferId);

// Initialize hardware components
Expand All @@ -136,6 +147,7 @@ void initDrivers()
gpsHandle->init();
imuHandle->init();
pmHandle->init();
rfdHandle->startReceive();

// Motor instance bindings
leftAileronMotorInstance = {leftAileronMotorHandle, true};
Expand Down
17 changes: 14 additions & 3 deletions stm32l552xx/boardfiles/model/src/managers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ alignas(TelemetryManager) static uint8_t tmHandleStorage[sizeof(TelemetryManager
AttitudeManager *amHandle = nullptr;
SystemManager *smHandle = nullptr;
TelemetryManager *tmHandle = nullptr;
DirectMapping *flightMode = nullptr;

Config *configHandle = nullptr;



void initManagers()
{
Expand All @@ -21,7 +26,8 @@ void initManagers()
imuHandle,
amRCQueueHandle,
tmQueueHandle,
smLoggerQueueHandle,
smLoggerQueueHandle,
smConfigAttitudeQueueHandle,
&rollMotors,
&pitchMotors,
&yawMotors,
Expand All @@ -31,22 +37,27 @@ void initManagers()
);

// SM initialization
configHandle = new Config(textIOHandle);
smHandle = new (&smHandleStorage) SystemManager(
loggerHandle,
configHandle,
systemUtilsHandle,
iwdgHandle,
loggerHandle,
rcHandle,
pmHandle,
amRCQueueHandle,
tmQueueHandle,
smLoggerQueueHandle
tmSmQueueHandle,
smLoggerQueueHandle,
smConfigRouteQueueHandle
);

// TM initialization
tmHandle = new (&tmHandleStorage) TelemetryManager(
systemUtilsHandle,
rfdHandle,
tmQueueHandle,
tmSmQueueHandle,
amRCQueueHandle,
messageBufferHandle
);
Expand Down
Loading
Loading