diff --git a/src/avr/src/main.c b/src/avr/src/main.c index 21a7296..3bdbec3 100644 --- a/src/avr/src/main.c +++ b/src/avr/src/main.c @@ -50,6 +50,7 @@ #include #include +#include // For emu @@ -61,13 +62,18 @@ int main(int argc, char *argv[]) { __argc = argc; __argv = argv; - wdt_enable(WDTO_250MS); + // Init cli(); // disable interrupts emu_init(); // Init emulator hw_init(); // hardware setup - must be first + + _delay_ms(5000); //2 seconds to charge capacitor banks, 1 second for shunt test, 2 seconds to recharge banks + + wdt_enable(WDTO_250MS); + outputs_init(); // output pins switch_init(); // switches estop_init(); // emergency stop handler diff --git a/src/pwr/config.h b/src/pwr/config.h index b482624..8449518 100644 --- a/src/pwr/config.h +++ b/src/pwr/config.h @@ -103,7 +103,7 @@ enum { #define VOLTAGE_REF_R2 1000 #define CURRENT_REF_R2 137 #define CURRENT_REF_MUL (100.0 * 2700 / CURRENT_REF_R2) // 2700 from datasheet -#define CAP_PRECHARGE_PERIOD 50 // ms +#define CAP_PRECHARGE_PERIOD 2000 // ms #define REG_SCALE 100 #define AVG_SCALE 3 diff --git a/src/pwr/main.c b/src/pwr/main.c index 6dd915d..7f70e81 100644 --- a/src/pwr/main.c +++ b/src/pwr/main.c @@ -369,14 +369,14 @@ static void validate_input_voltage() { static void charge_caps() { IO_PORT_SET(SHUNT_PIN); // Disable shunt (hi) - delay(1000); + delay(100); IO_PORT_SET(PC2_PIN); //Enable pre-charge circuit delay(CAP_PRECHARGE_PERIOD); //Wait for Vs caps to charge IO_PORT_CLR(PC2_PIN); //Disable pre-charge circuit - delay(1); + //delay(100); IO_PORT_SET(MOTOR_PIN); // Motor voltage on - delay(CAP_CHARGE_TIME); + //delay(CAP_CHARGE_TIME); }