Merge branch 'Rev4-PCB' into 1.0.10-devel

This commit is contained in:
OneFinityCNC
2021-12-19 12:05:03 -05:00
3 changed files with 11 additions and 5 deletions

View File

@@ -50,6 +50,7 @@
#include <stdio.h> #include <stdio.h>
#include <stdbool.h> #include <stdbool.h>
#include <util/delay.h>
// For emu // For emu
@@ -61,13 +62,18 @@ int main(int argc, char *argv[]) {
__argc = argc; __argc = argc;
__argv = argv; __argv = argv;
wdt_enable(WDTO_250MS);
// Init // Init
cli(); // disable interrupts cli(); // disable interrupts
emu_init(); // Init emulator emu_init(); // Init emulator
hw_init(); // hardware setup - must be first 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 outputs_init(); // output pins
switch_init(); // switches switch_init(); // switches
estop_init(); // emergency stop handler estop_init(); // emergency stop handler

View File

@@ -103,7 +103,7 @@ enum {
#define VOLTAGE_REF_R2 1000 #define VOLTAGE_REF_R2 1000
#define CURRENT_REF_R2 137 #define CURRENT_REF_R2 137
#define CURRENT_REF_MUL (100.0 * 2700 / CURRENT_REF_R2) // 2700 from datasheet #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 REG_SCALE 100
#define AVG_SCALE 3 #define AVG_SCALE 3

View File

@@ -369,14 +369,14 @@ static void validate_input_voltage() {
static void charge_caps() { static void charge_caps() {
IO_PORT_SET(SHUNT_PIN); // Disable shunt (hi) IO_PORT_SET(SHUNT_PIN); // Disable shunt (hi)
delay(1000); delay(100);
IO_PORT_SET(PC2_PIN); //Enable pre-charge circuit IO_PORT_SET(PC2_PIN); //Enable pre-charge circuit
delay(CAP_PRECHARGE_PERIOD); //Wait for Vs caps to charge delay(CAP_PRECHARGE_PERIOD); //Wait for Vs caps to charge
IO_PORT_CLR(PC2_PIN); //Disable pre-charge circuit IO_PORT_CLR(PC2_PIN); //Disable pre-charge circuit
delay(1); //delay(100);
IO_PORT_SET(MOTOR_PIN); // Motor voltage on IO_PORT_SET(MOTOR_PIN); // Motor voltage on
delay(CAP_CHARGE_TIME); //delay(CAP_CHARGE_TIME);
} }