From 26065e75ab99951eed3a038a250a602f8359b015 Mon Sep 17 00:00:00 2001 From: Peter Wittich Date: Mon, 13 Jan 2025 16:28:23 -0500 Subject: [PATCH] cleanup, delete unused code --- common/power_ctl.c | 1 + common/power_ctl.h | 2 +- projects/cm_mcu/InterruptHandlers.h | 4 ++-- projects/prod_test/ADCMonitorTask.c | 1 - projects/prod_test/ADCMonitorTask.h | 7 +++++++ projects/prod_test/commands.c | 18 +++--------------- projects/prod_test/printf_config.h | 3 +-- 7 files changed, 15 insertions(+), 21 deletions(-) diff --git a/common/power_ctl.c b/common/power_ctl.c index 8080d983..79fab6be 100644 --- a/common/power_ctl.c +++ b/common/power_ctl.c @@ -8,6 +8,7 @@ #include "common/power_ctl.h" #include "common/pinsel.h" #include "common/utils.h" +#include "power_ctl.h" #ifdef USE_FREERTOS #include "FreeRTOS.h" // IWYU pragma: keep diff --git a/common/power_ctl.h b/common/power_ctl.h index 564024ee..9c3ae349 100644 --- a/common/power_ctl.h +++ b/common/power_ctl.h @@ -54,6 +54,7 @@ enum ps_state { enum ps_state getPSStatus(int i); void setPSStatus(int i, enum ps_state theState); +#define PS_NUM_PRIORITIES 6 #ifdef REV1 // ----------------------------------------------------- @@ -95,7 +96,6 @@ void setPSStatus(int i, enum ps_state theState); // // ----------------------------------------------------- // Number of enable and power good/OK pins -#define PS_NUM_PRIORITIES 6 #define N_PS_ENABLES 10 #define N_PS_OKS 12 diff --git a/projects/cm_mcu/InterruptHandlers.h b/projects/cm_mcu/InterruptHandlers.h index 84b8f365..50519c85 100644 --- a/projects/cm_mcu/InterruptHandlers.h +++ b/projects/cm_mcu/InterruptHandlers.h @@ -13,8 +13,8 @@ #include "common/smbus.h" // FreeRTOS includes -#include "FreeRTOS.h" -#include "FreeRTOSConfig.h" +#include "FreeRTOS.h" // IWYU pragma: keep +#include "FreeRTOSConfig.h" // IWYU pragma: keep #include "stream_buffer.h" #include "task.h" diff --git a/projects/prod_test/ADCMonitorTask.c b/projects/prod_test/ADCMonitorTask.c index 19e61c32..97e1cb72 100644 --- a/projects/prod_test/ADCMonitorTask.c +++ b/projects/prod_test/ADCMonitorTask.c @@ -125,7 +125,6 @@ float getADCtargetValue(const int i) } #if defined(REV2) || defined(REV3) -#define ADC_DIFF_TOLERANCE 0.05f // in percent int check_ps_at_prio(int prio, bool f2_enable, bool f1_enable, float *delta) { // in the special case where neither f1 or f2 are enabled (no FPGAs), diff --git a/projects/prod_test/ADCMonitorTask.h b/projects/prod_test/ADCMonitorTask.h index cf8ba01d..3725cb99 100644 --- a/projects/prod_test/ADCMonitorTask.h +++ b/projects/prod_test/ADCMonitorTask.h @@ -1,4 +1,6 @@ #pragma once + +#include // On Apollo the ADC range is from 0 - 2.5V. // Some signals must be scaled to fit in this range. #define ADC_MAX_VOLTAGE_RANGE 2.5f @@ -15,3 +17,8 @@ #define ADC_INFO_CUR_INIT_CH 13 #define ADC_INFO_CUR_FIN_CH 17 #endif // REV2 or REV3 + +#define ADC_DIFF_TOLERANCE 0.05f // in percent + +float getADCtargetValue(int i); +int check_ps_at_prio(int prio, bool f2_enable, bool f1_enable, float *delta); diff --git a/projects/prod_test/commands.c b/projects/prod_test/commands.c index f84e2eba..e8db1239 100644 --- a/projects/prod_test/commands.c +++ b/projects/prod_test/commands.c @@ -62,15 +62,6 @@ __attribute__((noreturn)) BaseType_t bl_ctl(int argc, char **argv, char *m) __builtin_unreachable(); } -//// power control state names -// static const char *power_control_state_names[] = { -// #define X(name) #name, -// X_MACRO_PS_STATES -// #undef X -// }; - -int check_ps_at_prio(int prio, bool f2_enable, bool f1_enable, float *delta); - // turn on power at the specified level BaseType_t power_ctl(int argc, char **argv, char *m) { @@ -104,7 +95,6 @@ BaseType_t power_off_ctl(int argc, char **argv, char *m) return pdFALSE; } -// direct copy paste from other project? // This command takes no arguments BaseType_t restart_mcu(int argc, char **argv, char *m) { @@ -115,9 +105,7 @@ BaseType_t restart_mcu(int argc, char **argv, char *m) return pdFALSE; } -// this command takes no arguments -float getADCtargetValue(int i); - +// Display ADC measurements BaseType_t adc_ctl(int argc, char **argv, char *m) { int copied = 0; @@ -130,10 +118,10 @@ BaseType_t adc_ctl(int argc, char **argv, char *m) float val = getADCvalue(whichadc); copied += snprintf(m + copied, SCRATCH_SIZE - copied, "%14s: %5.2f", getADCname(whichadc), (double)val); - if (whichadc < ADC_INFO_CUR_INIT_CH) { // for voltage vals, check + if (whichadc < ADC_INFO_CUR_INIT_CH) { // for voltage vals, compare to expected float target_val = getADCtargetValue(whichadc); float diff = (target_val - val) / val; - if (ABS(diff) > 0.05f) { + if (ABS(diff) > ADC_DIFF_TOLERANCE) { copied += snprintf(m + copied, SCRATCH_SIZE - copied, "\tBAD"); } } diff --git a/projects/prod_test/printf_config.h b/projects/prod_test/printf_config.h index 65c412b1..0866208c 100644 --- a/projects/prod_test/printf_config.h +++ b/projects/prod_test/printf_config.h @@ -1,14 +1,13 @@ /* * printf_config.h * - * Created on: Jun 1, 2021 + * Created on: Jan 2025 * Author: pw94 */ #ifndef PROD_TEST_PRINTF_CONFIG_H_ #define PROD_TEST_PRINTF_CONFIG_H_ -// #define PRINTF_DISABLE_SUPPORT_FLOAT #define PRINTF_DISABLE_SUPPORT_EXPONENTIAL #define PRINTF_DISABLE_SUPPORT_LONG_LONG #define PRINTF_DISABLE_SUPPORT_PTRDIFF_T