Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
12 changes: 6 additions & 6 deletions Tools/AP_Periph/AP_Periph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -315,10 +315,10 @@ void AP_Periph_FW::init()
relay.init();
#endif

#ifdef HAL_PERIPH_ENABLE_FSO_POWER_STACK
#if AP_PERIPH_FSO_POWERSTACK_ENABLED
FSO_power_stack.init();
#endif
#endif // AP_PERIPH_FSO_POWERSTACK_ENABLED

#if AP_SCRIPTING_ENABLED
scripting.init();
#endif
Expand Down Expand Up @@ -525,10 +525,10 @@ void AP_Periph_FW::update()
batt_balance_update();
#endif

#ifdef HAL_PERIPH_ENABLE_FSO_POWER_STACK
#if AP_PERIPH_FSO_POWERSTACK_ENABLED
FSO_power_stack.update(battery.last_read_ms == now);
#endif
#endif // AP_PERIPH_FSO_POWERSTACK_ENABLED

static uint32_t fiftyhz_last_update_ms;
if (now - fiftyhz_last_update_ms >= 20) {
// update at 50Hz
Expand Down
20 changes: 12 additions & 8 deletions Tools/AP_Periph/AP_Periph.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,6 @@
#endif
#include <AP_AHRS/AP_AHRS.h>

#ifdef HAL_PERIPH_ENABLE_FSO_POWER_STACK
#include "FSOPowerStack.h"
#endif
#include <AP_DAC/AP_DAC.h>

#if AP_PERIPH_RELAY_ENABLED
#if AP_PERIPH_PWM_HARDPOINT_ENABLED
#error "Relay and PWM_HARDPOINT both use hardpoint message"
Expand Down Expand Up @@ -111,6 +106,15 @@
#define AP_SIM_PARAM_ENABLED AP_SIM_ENABLED
#endif

#ifndef AP_PERIPH_FSO_POWERSTACK_ENABLED
#define AP_PERIPH_FSO_POWERSTACK_ENABLED 0
#endif // AP_PERIPH_FSO_POWERSTACK_ENABLED

#if AP_PERIPH_FSO_POWERSTACK_ENABLED
#include "FSOPowerStack.h"
#endif // AP_PERIPH_FSO_POWERSTACK_ENABLED
#include <AP_DAC/AP_DAC.h>

#if defined(HAL_PERIPH_LISTEN_FOR_SERIAL_UART_REBOOT_CMD_PORT) && !defined(HAL_DEBUG_BUILD) && !defined(HAL_PERIPH_LISTEN_FOR_SERIAL_UART_REBOOT_NON_DEBUG)
/* this checking for reboot can lose bytes on GPS modules and other
* serial devices. It is really only relevant on a debug build if you
Expand Down Expand Up @@ -398,10 +402,10 @@ class AP_Periph_FW {
BattBalance battery_balance;
#endif

#ifdef HAL_PERIPH_ENABLE_FSO_POWER_STACK
#if AP_PERIPH_FSO_POWERSTACK_ENABLED
FSOPowerStack FSO_power_stack;
#endif
#endif // AP_PERIPH_FSO_POWERSTACK_ENABLED

#if AP_PERIPH_BATTERY_TAG_ENABLED
BatteryTag battery_tag;
#endif
Expand Down
4 changes: 2 additions & 2 deletions Tools/AP_Periph/FSOPowerStack.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

#include "AP_Periph.h"

#ifdef HAL_PERIPH_ENABLE_FSO_POWER_STACK
#if AP_PERIPH_FSO_POWERSTACK_ENABLED

#include <dronecan_msgs.h>

Expand Down Expand Up @@ -1649,5 +1649,5 @@ void FSOPowerStack::update(bool battery_read)
report_errors();
}

#endif // HAL_PERIPH_ENABLE_FSO_POWER_STACK
#endif // AP_PERIPH_FSO_POWERSTACK_ENABLED

4 changes: 2 additions & 2 deletions Tools/AP_Periph/FSOPowerStack.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma once

#ifdef HAL_PERIPH_ENABLE_FSO_POWER_STACK
#if AP_PERIPH_FSO_POWERSTACK_ENABLED

#include <AP_DAC/AP_DAC.h>

Expand Down Expand Up @@ -244,6 +244,6 @@ class FSOPowerStack {
bool done_late_init;
};

#endif // HAL_PERIPH_ENABLE_FSO_POWER_STACK
#endif // AP_PERIPH_FSO_POWERSTACK_ENABLED


4 changes: 2 additions & 2 deletions Tools/AP_Periph/Parameters.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -751,11 +751,11 @@ const AP_Param::Info AP_Periph_FW::var_info[] = {
GSCALAR(servo_command_timeout_ms, "SRV_CMD_TIME_OUT", 200),
#endif

#ifdef HAL_PERIPH_ENABLE_FSO_POWER_STACK
#if AP_PERIPH_FSO_POWERSTACK_ENABLED
// @Group: FSO
// @Path: FSOPowerStack.cpp
GOBJECT(FSO_power_stack, "AAA", FSOPowerStack),
#endif
#endif // AP_PERIPH_FSO_POWERSTACK_ENABLED

AP_VAREND
};
Expand Down
6 changes: 0 additions & 6 deletions libraries/AP_HAL_ChibiOS/hwdef/FSOPowerStack/hwdef-bl.dat
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,8 @@ define STM32_SERIAL_USE_USART3 FALSE

define HAL_USE_EMPTY_IO TRUE

# avoid timer and RCIN threads to save memory
define HAL_NO_TIMER_THREAD
define HAL_RCIN_THREAD_ENABLED 0

define DMA_RESERVE_SIZE 0

define HAL_SCHEDULER_LOOP_DELAY_ENABLED 0

# default to all pins low to avoid ESD issues
DEFAULTGPIO OUTPUT LOW PULLDOWN

Expand Down
26 changes: 9 additions & 17 deletions libraries/AP_HAL_ChibiOS/hwdef/FSOPowerStack/hwdef.dat
Original file line number Diff line number Diff line change
Expand Up @@ -23,27 +23,24 @@ FLASH_SIZE_KB 512
# Enable Options
define AP_TEMPERATURE_SENSOR_ENABLED 1
define AP_TEMPERATURE_SENSOR_TSYS03_ENABLED 1

# Power monitoring
define AP_PERIPH_BATTERY_ENABLED 1
define AP_BATTERY_SUM_ENABLED 1
define AP_BATT_MONITOR_MAX_INSTANCES 10
define AP_BATTERY_BACKEND_DEFAULT_ENABLED 0
define AP_BATTERY_ANALOG_ENABLED 1
define AP_BATTERY_INA2XX_ENABLED 1
define AP_BATTERY_SUM_ENABLED 1

define AP_PERIPH_RC_OUT_ENABLED 1

define AP_PERIPH_NOTIFY_ENABLED 1
define HAL_PERIPH_ENABLE_FSO_POWER_STACK 1

define AP_BATT_MONITOR_MAX_INSTANCES 10
define AP_BATTERY_BACKEND_DEFAULT_ENABLED 0
define AP_BATTERY_INA2XX_ENABLED 1
define AP_BATTERY_ANALOG_ENABLED 1
define AP_PERIPH_FSO_POWERSTACK_ENABLED 1

# enable DAC
define AP_DAC_ENABLED 1

# Disable Options
define HAL_RCIN_THREAD_ENABLED 0
define HAL_USE_RTC FALSE
define HAL_SERIAL_ESC_COMM_ENABLED 0
define HAL_SCHEDULER_LOOP_DELAY_ENABLED 0

# enable serial LED
define AP_NOTIFY_NEOPIXEL_ENABLED 1
define AP_SERIALLED_ENABLED 1
Expand All @@ -54,8 +51,6 @@ define STM32_PPRE2 STM32_PPRE2_DIV8
# Set Options
define DMA_RESERVE_SIZE 0

env DISABLE_SCRIPTING 1

# ---------------------- UARTs ---------------------------

define AP_PERIPH_SERIAL_OPTIONS_ENABLED 1
Expand Down Expand Up @@ -186,9 +181,6 @@ define HAL_GPIO_LED_ON 1
define AP_NOTIFY_GPIO_LED_RGB_ENABLED 1
define DEFAULT_NTF_LED_TYPES 257

define HAL_LOGGING_ENABLED 0
define HAL_MONITOR_THREAD_ENABLED 0

define HAL_DEVICE_THREAD_STACK 768

# we setup a small defaults.parm
Expand Down
Loading