parent
407c9834d1
commit
5b8c409c10
4 changed files with 22 additions and 6 deletions
|
|
@ -7,6 +7,7 @@ int compThrs = COMP_THRESHOLD_DEFAULT;
|
||||||
int LOOP_DUR = LOOP_DUR_DEFAULT; // duration of time between ADC checks and other loop functions
|
int LOOP_DUR = LOOP_DUR_DEFAULT; // duration of time between ADC checks and other loop functions
|
||||||
int TRG_DUR = TRG_DUR_DEFAULT; // duration of the Z-axis pulse sent, in ms
|
int TRG_DUR = TRG_DUR_DEFAULT; // duration of the Z-axis pulse sent, in ms
|
||||||
int Hyst = HYST_DEFAULT; // Hysteresis value for ADC measurements
|
int Hyst = HYST_DEFAULT; // Hysteresis value for ADC measurements
|
||||||
|
bool LOGIC = LOGIC_DEFAULT; // Trigger output logic (active low or active high)
|
||||||
int Debug = 0;
|
int Debug = 0;
|
||||||
long voltMeterConstant = VM_CONST_DEFAULT;
|
long voltMeterConstant = VM_CONST_DEFAULT;
|
||||||
uint8_t pP_i2c_address = 0xa0;
|
uint8_t pP_i2c_address = 0xa0;
|
||||||
|
|
@ -21,6 +22,7 @@ void eraseEEPROM() {
|
||||||
EEPROM.put(LOOP_DUR_ADDRESS, LOOP_DUR);
|
EEPROM.put(LOOP_DUR_ADDRESS, LOOP_DUR);
|
||||||
EEPROM.put(TRG_DUR_ADDRESS, TRG_DUR);
|
EEPROM.put(TRG_DUR_ADDRESS, TRG_DUR);
|
||||||
EEPROM.put(HYST_ADDRESS, Hyst);
|
EEPROM.put(HYST_ADDRESS, Hyst);
|
||||||
|
EEPROM.put(LOGIC_ADDRESS, LOGIC);
|
||||||
EEPROM.put(VM_CONST_ADDRESS, voltMeterConstant);
|
EEPROM.put(VM_CONST_ADDRESS, voltMeterConstant);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -72,6 +74,13 @@ void restoreConfig() {
|
||||||
Hyst = temp;
|
Hyst = temp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EEPROM.get(LOGIC_ADDRESS, temp);
|
||||||
|
if (temp < 0 || temp > 1) {
|
||||||
|
reset = true;
|
||||||
|
} else {
|
||||||
|
LOGIC = temp;
|
||||||
|
}
|
||||||
|
|
||||||
long longTemp;
|
long longTemp;
|
||||||
EEPROM.get(VM_CONST_ADDRESS, longTemp);
|
EEPROM.get(VM_CONST_ADDRESS, longTemp);
|
||||||
if (longTemp < 1000000L || longTemp > 1200000L) {
|
if (longTemp < 1000000L || longTemp > 1200000L) {
|
||||||
|
|
@ -92,5 +101,6 @@ void setDefaultConfig() {
|
||||||
LOOP_DUR = LOOP_DUR_DEFAULT;
|
LOOP_DUR = LOOP_DUR_DEFAULT;
|
||||||
TRG_DUR = TRG_DUR_DEFAULT;
|
TRG_DUR = TRG_DUR_DEFAULT;
|
||||||
Hyst = HYST_DEFAULT;
|
Hyst = HYST_DEFAULT;
|
||||||
|
LOGIC = LOGIC_DEFAULT;
|
||||||
voltMeterConstant = VM_CONST_DEFAULT;
|
voltMeterConstant = VM_CONST_DEFAULT;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -43,8 +43,14 @@
|
||||||
extern int Hyst; // Hysteresis value for ADC measurements
|
extern int Hyst; // Hysteresis value for ADC measurements
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define LOGIC_DEFAULT 0
|
||||||
|
#define LOGIC_ADDRESS 24
|
||||||
|
#if !(defined(LOGIC))
|
||||||
|
extern bool LOGIC; // Trigger logic scheme, Active LOW is default
|
||||||
|
#endif
|
||||||
|
|
||||||
#if !(defined(Debug))
|
#if !(defined(Debug))
|
||||||
extern int Debug;
|
extern int Debug;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define VM_CONST_ADDRESS 28
|
#define VM_CONST_ADDRESS 28
|
||||||
|
|
@ -58,10 +64,10 @@
|
||||||
#if !(defined(pP_i2c_address))
|
#if !(defined(pP_i2c_address))
|
||||||
extern uint8_t pP_i2c_address; // I2C Bus Address
|
extern uint8_t pP_i2c_address; // I2C Bus Address
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif // I2C_INPUT
|
||||||
|
|
||||||
void eraseEEPROM();
|
void eraseEEPROM();
|
||||||
void setDefaultConfig();
|
void setDefaultConfig();
|
||||||
void restoreConfig();
|
void restoreConfig();
|
||||||
|
|
||||||
#endif
|
#endif // PP_CONFIG_H
|
||||||
|
|
|
||||||
|
|
@ -23,10 +23,10 @@ int inline analogReadFast(byte ADCpin)
|
||||||
/*------------------------------------------------*/
|
/*------------------------------------------------*/
|
||||||
|
|
||||||
void pulse() {
|
void pulse() {
|
||||||
digitalWriteFast(TRG_OUT, LOW);
|
digitalWriteFast(TRG_OUT, LOGIC);
|
||||||
sensorHReading = 1;
|
sensorHReading = 1;
|
||||||
delay(TRG_DUR);
|
delay(TRG_DUR);
|
||||||
digitalWriteFast(TRG_OUT, HIGH);
|
digitalWriteFast(TRG_OUT, !LOGIC);
|
||||||
Serial.println("Trig'd!");
|
Serial.println("Trig'd!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ int VFol = 0;
|
||||||
|
|
||||||
// Error blink parameters
|
// Error blink parameters
|
||||||
|
|
||||||
int BlinkState = LOW;
|
int BlinkState = 0;
|
||||||
int BlinkCount = (InitCount * 2) + 1; // Multiply Blink count by 2 to handle toggle state, add one extra to make sure light is on after
|
int BlinkCount = (InitCount * 2) + 1; // Multiply Blink count by 2 to handle toggle state, add one extra to make sure light is on after
|
||||||
|
|
||||||
// Serial Input Parsing Variables
|
// Serial Input Parsing Variables
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue