Lots of refactoring
This commit is contained in:
@@ -8,18 +8,53 @@
|
||||
#ifndef SYSTEM_SYSTEM_H_
|
||||
#define SYSTEM_SYSTEM_H_
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
#include "ports.h"
|
||||
#include "adc.h"
|
||||
|
||||
#define SW_VERSION "1.10A"
|
||||
|
||||
|
||||
#define SYS_INFO_LENGTH 24 //max string length for setup parameters (model, mfg, etc.)
|
||||
|
||||
#define POWER_LIMIT_LITHIUM 10.0f
|
||||
#define POWER_LIMIT_ALKALINE 5.0f
|
||||
#define POWER_LIMIT_EXT_DC 10.0f
|
||||
|
||||
typedef enum
|
||||
{
|
||||
GUI_MODE_NORMAL = 0,
|
||||
GUI_MODE_MENU
|
||||
} GuiMode_t;
|
||||
|
||||
typedef struct ClampData_s
|
||||
{
|
||||
float slope;
|
||||
uint8_t pot;
|
||||
float voltage;
|
||||
float current;
|
||||
float impedance;
|
||||
float power;
|
||||
float maxPower;
|
||||
float targetPower;
|
||||
uint32_t timeout;
|
||||
bool regulate;
|
||||
uint8_t prevPowerLevel;
|
||||
|
||||
} ClampData_t;
|
||||
|
||||
|
||||
|
||||
|
||||
typedef enum
|
||||
{ USB_CONNECTED = 0,
|
||||
SAFE_MODE,
|
||||
OVERVOLTAGE,
|
||||
ESTOP,
|
||||
BYPASS,
|
||||
NUM_STATUS_FLAGS
|
||||
} StatusFlags_t;
|
||||
|
||||
//System data
|
||||
typedef struct
|
||||
@@ -36,8 +71,26 @@ typedef struct
|
||||
|
||||
uint32_t systemTime; // system time in milliseconds since boot
|
||||
|
||||
bool safeMode; // output is disabled
|
||||
|
||||
bool usbConnected;
|
||||
|
||||
GuiMode_t guiMode;
|
||||
|
||||
ClampData_t clamp;
|
||||
|
||||
uint8_t currentMode;
|
||||
|
||||
ACCESSORY_t ports[NUM_PORTS];
|
||||
|
||||
float32_t maxPowerLimit;
|
||||
|
||||
ADC_t adc;
|
||||
|
||||
bool status[NUM_STATUS_FLAGS];
|
||||
|
||||
|
||||
|
||||
} SYSTEM_DATA_t;
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user