Skip to content

Commit

Permalink
Merge pull request #434 from rosflight/ptt/init_reporting
Browse files Browse the repository at this point in the history
Ptt/init reporting
  • Loading branch information
bsutherland333 authored Sep 4, 2024
2 parents b84cdf7 + b7e4ee6 commit a8cccf7
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 16 deletions.
2 changes: 1 addition & 1 deletion boards/varmint_h7
Submodule varmint_h7 updated 81 files
+0 −168 common/AL94_USB_Composite/App/usb_device.c
+0 −105 common/AL94_USB_Composite/App/usb_device.h
+0 −541 common/AL94_USB_Composite/App/usbd_cdc_acm_if.c
+0 −131 common/AL94_USB_Composite/App/usbd_cdc_acm_if.h
+0 −415 common/AL94_USB_Composite/App/usbd_desc.c
+0 −146 common/AL94_USB_Composite/App/usbd_desc.h
+0 −180 common/AL94_USB_Composite/Class/CDC_ACM/Inc/usbd_cdc_acm.h
+0 −2,175 common/AL94_USB_Composite/Class/CDC_ACM/Src/usbd_cdc_acm.c
+0 −151 common/AL94_USB_Composite/Class/COMPOSITE/Inc/usbd_composite.h
+0 −1,133 common/AL94_USB_Composite/Class/COMPOSITE/Src/usbd_composite.c
+0 −149 common/AL94_USB_Composite/Core/Inc/usbd_core.h
+0 −99 common/AL94_USB_Composite/Core/Inc/usbd_ctlreq.h
+0 −429 common/AL94_USB_Composite/Core/Inc/usbd_def.h
+0 −107 common/AL94_USB_Composite/Core/Inc/usbd_ioreq.h
+0 −673 common/AL94_USB_Composite/Core/Src/usbd_core.c
+0 −928 common/AL94_USB_Composite/Core/Src/usbd_ctlreq.c
+0 −176 common/AL94_USB_Composite/Target/usbd_conf.h
+2 −7 common/CMakeLists.txt
+3 −18 common/CommonConfig.h
+3 −3 common/STM32H7LinkerScript.ld
+90 −90 common/USB_AL94/AL94.I-CUBE-USBD-COMPOSITE_conf.h-ignore
+20 −20 common/USB_AL94/LICENSE.txt
+58 −0 common/USB_AL94/usb_device.c
+41 −0 common/USB_AL94/usb_device.h
+2,052 −0 common/USB_AL94/usbd_cdc.c
+151 −0 common/USB_AL94/usbd_cdc.h
+238 −0 common/USB_AL94/usbd_cdc_if.c
+39 −0 common/USB_AL94/usbd_cdc_if.h
+366 −0 common/USB_AL94/usbd_composite.c
+58 −0 common/USB_AL94/usbd_composite.h
+796 −816 common/USB_AL94/usbd_conf.c
+106 −0 common/USB_AL94/usbd_conf.h
+517 −0 common/USB_AL94/usbd_core.c
+93 −0 common/USB_AL94/usbd_core.h
+801 −0 common/USB_AL94/usbd_ctlreq.c
+43 −0 common/USB_AL94/usbd_ctlreq.h
+385 −0 common/USB_AL94/usbd_def.h
+270 −0 common/USB_AL94/usbd_desc.c
+47 −0 common/USB_AL94/usbd_desc.h
+149 −214 common/USB_AL94/usbd_ioreq.c
+49 −0 common/USB_AL94/usbd_ioreq.h
+34 −8 common/Varmint.cpp
+13 −2 common/Varmint.h
+10 −4 common/drivers/Adc.cpp
+21 −10 common/drivers/Adis165xx.cpp
+330 −327 common/drivers/Auav.cpp
+99 −99 common/drivers/Auav.h
+5 −4 common/drivers/Bmi088.cpp
+17 −4 common/drivers/ByteFifo.h
+6 −5 common/drivers/DlhrL20G.cpp
+5 −4 common/drivers/Dps310.cpp
+9 −1 common/drivers/Driver.h
+5 −4 common/drivers/Iis2mdc.cpp
+31 −11 common/drivers/Ist8308.cpp
+8 −4 common/drivers/Mcp4017.h
+6 −6 common/drivers/Ms4525.cpp
+19 −9 common/drivers/PacketFifo.h
+28 −7 common/drivers/Pwm.cpp
+3 −1 common/drivers/Pwm.h
+19 −5 common/drivers/Sbus.cpp
+8 −3 common/drivers/Sd.cpp
+2 −2 common/drivers/Sd.h
+7 −4 common/drivers/Spi.h
+57 −0 common/drivers/Status.h
+19 −6 common/drivers/Telem.cpp
+1 −1 common/drivers/Telem.h
+35 −12 common/drivers/Time64.h
+37 −13 common/drivers/Ubx.cpp
+5 −2 common/drivers/Vcp.cpp
+1 −1 common/drivers/Vcp.h
+2 −6 common/drivers/misc.cpp
+5 −1 fix-format-varmint.sh
+10 −0 make_links.bat
+46 −13 pixracer_pro/.cproject
+0 −177 pixracer_pro/STM32H743IIKX_RAM.ld
+5 −4 pixracer_pro/specific/BoardConfig.h
+6 −2 pixracer_pro/specific/Varmint_Init.cpp
+109 −12 varmint_10X/.cproject
+0 −173 varmint_10X/STM32H753VIHX_RAM.ld
+4 −2 varmint_10X/specific/BoardConfig.h
+2 −2 varmint_10X/specific/Varmint_Init.cpp
12 changes: 8 additions & 4 deletions include/board.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,13 @@ class Board
virtual void init_board() = 0;
virtual void board_reset(bool bootloader) = 0;

virtual void sensors_init(void) = 0;
virtual uint16_t sensors_errors_count() = 0;

virtual uint16_t sensors_init_message_count() = 0;
virtual bool sensors_init_message_good(uint16_t i) = 0;
virtual uint16_t sensors_init_message(char *message, uint16_t size, uint16_t i) = 0;

// clock
virtual uint32_t clock_millis() = 0;
virtual uint64_t clock_micros() = 0;
Expand All @@ -67,11 +74,8 @@ class Board
virtual uint8_t serial_read() = 0;
virtual void serial_flush() = 0;

// sensors
virtual void sensors_init() = 0;
virtual uint16_t num_sensor_errors() = 0;

// IMU
virtual bool imu_present() = 0;
virtual bool imu_has_new_data() = 0;
virtual bool imu_read(float accel[3], float * temperature, float gyro[3], uint64_t * time) = 0;
virtual void imu_not_responding_error() = 0;
Expand Down
3 changes: 1 addition & 2 deletions include/comm_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,6 @@ class CommManager : public CommLinkInterface::ListenerInterface, public ParamLis

// Debugging Utils
void send_named_value_int(const char * const name, int32_t value);
// void send_named_command_struct(const char *const name, control_t command_struct);

void send_next_param(void);

Expand All @@ -180,8 +179,8 @@ class CommManager : public CommLinkInterface::ListenerInterface, public ParamLis
void send_param_value(uint16_t param_id);
void update_status();
void log(CommLinkInterface::LogSeverity severity, const char * fmt, ...);
void log_message(CommLinkInterface::LogSeverity severity, char * text);

void send_parameter_list();
void send_named_value_float(const char * const name, float value);

void send_backup_data(const StateManager::BackupData & backup_data);
Expand Down
1 change: 0 additions & 1 deletion include/interface/comm_link.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
#ifndef ROSFLIGHT_FIRMWARE_COMM_LINK_H
#define ROSFLIGHT_FIRMWARE_COMM_LINK_H

#include "board.h"
#include "param.h"
#include "sensors.h"
#include "state_manager.h"
Expand Down
13 changes: 8 additions & 5 deletions src/comm_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,6 @@ void CommManager::param_request_list_callback(uint8_t target_system)
if (target_system == sysid_) { send_params_index_ = 0; }
}

void CommManager::send_parameter_list() { send_params_index_ = 0; }

void CommManager::param_request_read_callback(uint8_t target_system, const char * const param_name,
int16_t param_index)
{
Expand Down Expand Up @@ -329,10 +327,15 @@ void CommManager::log(CommLinkInterface::LogSeverity severity, const char * fmt,
// Convert the format string to a raw char array
va_list args;
va_start(args, fmt);
char text[LOG_MSG_SIZE];
vsnprintf(text, LOG_MSG_SIZE, fmt, args);
char message[LOG_MSG_SIZE];
vsnprintf(message, LOG_MSG_SIZE, fmt, args);
va_end(args);

log_message(severity, message);
}

void CommManager::log_message(CommLinkInterface::LogSeverity severity, char * text)
{
if (initialized_ && connected_) {
comm_link_.send_log_message(sysid_, severity, text);
} else {
Expand Down Expand Up @@ -361,7 +364,7 @@ void CommManager::send_status(void)
comm_link_.send_status(
sysid_, RF_.state_manager_.state().armed, RF_.state_manager_.state().failsafe,
RF_.command_manager_.rc_override_active(), RF_.command_manager_.offboard_control_active(),
RF_.state_manager_.state().error_codes, control_mode, RF_.board_.num_sensor_errors(),
RF_.state_manager_.state().error_codes, control_mode, RF_.board_.sensors_errors_count(),
RF_.get_loop_time_us());
}

Expand Down
9 changes: 7 additions & 2 deletions test/test_board.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,13 @@ uint8_t testBoard::serial_read() { return 0; }
void testBoard::serial_flush() {}

// sensors
void testBoard::sensors_init() {}
uint16_t testBoard::num_sensor_errors() { return 0; }
void testBoard::sensors_init() {};
uint16_t testBoard::sensors_errors_count() {return 0;}
uint16_t testBoard::sensors_init_message_count() {return 0;}
uint16_t testBoard::sensors_init_message(char * message, uint16_t size, uint16_t i) {return 0;}
bool testBoard::sensors_init_message_good(uint16_t i) {return false;}

bool testBoard::imu_present() {return false;}

bool testBoard::imu_has_new_data()
{
Expand Down
6 changes: 5 additions & 1 deletion test/test_board.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,12 @@ class testBoard : public Board

// sensors
void sensors_init() override;
uint16_t num_sensor_errors() override;
uint16_t sensors_errors_count() override;
uint16_t sensors_init_message_count() override;
uint16_t sensors_init_message(char * message, uint16_t size, uint16_t i) override;
bool sensors_init_message_good(uint16_t i) override;

bool imu_present() override;
bool imu_has_new_data() override;
bool imu_read(float accel[3], float * temperature, float gyro[3], uint64_t * time) override;
void imu_not_responding_error() override;
Expand Down

0 comments on commit a8cccf7

Please sign in to comment.