changed variables from static to extern for use in other functions
This commit is contained in:
parent
f52abb8ef0
commit
757165c9bf
@ -64,9 +64,9 @@ typedef struct {
|
||||
extern StateHandle state;
|
||||
static bool relay_closed = 0;
|
||||
static bool precharge_closed = 0;
|
||||
static int16_t RELAY_BAT_SIDE_VOLTAGE;
|
||||
static int16_t RELAY_ESC_SIDE_VOLTAGE;
|
||||
static int16_t CURRENT_MEASUREMENT;
|
||||
extern int16_t RELAY_BAT_SIDE_VOLTAGE;
|
||||
extern int16_t RELAY_ESC_SIDE_VOLTAGE;
|
||||
extern int16_t CURRENT_MEASUREMENT;
|
||||
|
||||
void sm_init();
|
||||
void sm_update();
|
||||
|
@ -2,7 +2,10 @@
|
||||
#include "stm32f3xx_hal.h"
|
||||
|
||||
StateHandle state;
|
||||
static uint32_t timestamp;
|
||||
int16_t RELAY_BAT_SIDE_VOLTAGE;
|
||||
int16_t RELAY_ESC_SIDE_VOLTAGE;
|
||||
int16_t CURRENT_MEASUREMENT;
|
||||
uint32_t timestamp;
|
||||
|
||||
void sm_init(){
|
||||
state.current_state = STATE_INACTIVE;
|
||||
@ -11,9 +14,9 @@ void sm_init(){
|
||||
}
|
||||
|
||||
void sm_update(){
|
||||
RELAY_BAT_SIDE_VOLTAGE = module.auxVoltages[0] * 11.989;
|
||||
RELAY_ESC_SIDE_VOLTAGE = module.auxVoltages[1] * 11.989;
|
||||
CURRENT_MEASUREMENT = module.auxVoltages[2] ;
|
||||
RELAY_BAT_SIDE_VOLTAGE = module.auxVoltages[0] * 12.42; // the calculation says the factor is 11.989. 12.42 yields the better result
|
||||
RELAY_ESC_SIDE_VOLTAGE = module.auxVoltages[1] * 12.42;
|
||||
CURRENT_MEASUREMENT = module.auxVoltages[2] / 2.2;
|
||||
|
||||
switch (state.current_state) {
|
||||
case STATE_INACTIVE:
|
||||
|
Loading…
x
Reference in New Issue
Block a user