Skip to content

Commit

Permalink
cleanup, delete unused code
Browse files Browse the repository at this point in the history
  • Loading branch information
pwittich committed Jan 13, 2025
1 parent 941854c commit 26065e7
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 21 deletions.
1 change: 1 addition & 0 deletions common/power_ctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion common/power_ctl.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
// -----------------------------------------------------
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions projects/cm_mcu/InterruptHandlers.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
1 change: 0 additions & 1 deletion projects/prod_test/ADCMonitorTask.c
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
7 changes: 7 additions & 0 deletions projects/prod_test/ADCMonitorTask.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#pragma once

#include <stdbool.h>
// 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
Expand All @@ -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);
18 changes: 3 additions & 15 deletions projects/prod_test/commands.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down Expand Up @@ -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)
{
Expand All @@ -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;
Expand All @@ -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");
}
}
Expand Down
3 changes: 1 addition & 2 deletions projects/prod_test/printf_config.h
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit 26065e7

Please sign in to comment.