Firmware changes for Rev 4 PCB

Firmware changes for Rev 4 PCB
This commit is contained in:
OneFinityCNC
2021-05-19 15:18:53 -04:00
parent a00c8f7dfd
commit 75bb20b250
3 changed files with 11 additions and 5 deletions

View File

@@ -50,6 +50,7 @@
#include <stdio.h>
#include <stdbool.h>
#include <util/delay.h>
// 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

View File

@@ -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

View File

@@ -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);
}