Merge branch 'develop' of https://github.com/pyr0ball/pyr0piezo into develop

This commit is contained in:
pyr0ball 2019-12-12 16:46:27 -08:00
commit 7577694208
6 changed files with 33 additions and 33 deletions

View file

@ -1,23 +0,0 @@
{
"configurations": [
{
"name": "Win32",
"includePath": [
"${HOME}\\AppData\\Local\\Arduino15\\packages\\MiniCore\\hardware\\avr\\2.0.3\\**",
"${workspaceFolder}\\**",
"D:\\Arduino\\**"
],
"defines": [
"_DEBUG",
"UNICODE",
"_UNICODE"
],
"compilerPath": "C:\\Program Files\\LLVM\\bin\\clang.exe",
"cStandard": "c11",
"cppStandard": "c++17",
"intelliSenseMode": "clang-x64",
"forcedInclude": []
}
],
"version": 4
}

View file

@ -8,19 +8,24 @@
; Please visit documentation for the other options and examples
; https://docs.platformio.org/page/projectconf.html
[platformio]
default_envs = ATmega328PB
[env:ATmega88P]
platform = atmelavr
board = ATmega88P
framework = arduino
lib_deps = Arduino
upload_protocol = stk500v1
; each flag in a new line
upload_flags =
-P$UPLOAD_PORT
-b$UPLOAD_SPEED
-fmax_errors=5
; edit these lines
upload_port = COM4
upload_speed = 19200
; upload_port = COM4
upload_speed = 38400
board_build.f_cpu = 8000000L
board_fuses.lfuse = "0xE2"
@ -31,14 +36,16 @@ board_fuses.efuse = "0xF9"
platform = atmelavr
board = ATmega328PB
framework = arduino
lib_deps = Arduino
upload_protocol = stk500v1
; each flag in a new line
upload_flags =
-P$UPLOAD_PORT
-b$UPLOAD_SPEED
-fmax_errors=5
; edit these lines
upload_port = COM4
upload_speed = 19200
;upload_port = COM4
upload_speed = 38400
board_build.f_cpu = 8000000L

View file

@ -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 TRG_DUR = TRG_DUR_DEFAULT; // duration of the Z-axis pulse sent, in ms
int Hyst = HYST_DEFAULT; // Hysteresis value for ADC measurements
bool LOGIC = LOGIC_DEFAULT; // Trigger output logic (active low or active high)
int Debug = 0;
long voltMeterConstant = VM_CONST_DEFAULT;
uint8_t pP_i2c_address = 0xa0;
@ -21,6 +22,7 @@ void eraseEEPROM() {
EEPROM.put(LOOP_DUR_ADDRESS, LOOP_DUR);
EEPROM.put(TRG_DUR_ADDRESS, TRG_DUR);
EEPROM.put(HYST_ADDRESS, Hyst);
EEPROM.put(LOGIC_ADDRESS, LOGIC);
EEPROM.put(VM_CONST_ADDRESS, voltMeterConstant);
}
@ -72,6 +74,13 @@ void restoreConfig() {
Hyst = temp;
}
EEPROM.get(LOGIC_ADDRESS, temp);
if (temp < 0 || temp > 1) {
reset = true;
} else {
LOGIC = temp;
}
long longTemp;
EEPROM.get(VM_CONST_ADDRESS, longTemp);
if (longTemp < 1000000L || longTemp > 1200000L) {
@ -92,5 +101,6 @@ void setDefaultConfig() {
LOOP_DUR = LOOP_DUR_DEFAULT;
TRG_DUR = TRG_DUR_DEFAULT;
Hyst = HYST_DEFAULT;
LOGIC = LOGIC_DEFAULT;
voltMeterConstant = VM_CONST_DEFAULT;
}

View file

@ -43,8 +43,14 @@
extern int Hyst; // Hysteresis value for ADC measurements
#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))
extern int Debug;
extern int Debug;
#endif
#define VM_CONST_ADDRESS 28
@ -58,10 +64,10 @@
#if !(defined(pP_i2c_address))
extern uint8_t pP_i2c_address; // I2C Bus Address
#endif
#endif
#endif // I2C_INPUT
void eraseEEPROM();
void setDefaultConfig();
void restoreConfig();
#endif
#endif // PP_CONFIG_H

View file

@ -23,10 +23,10 @@ int inline analogReadFast(byte ADCpin)
/*------------------------------------------------*/
void pulse() {
digitalWriteFast(TRG_OUT, LOW);
digitalWriteFast(TRG_OUT, LOGIC);
sensorHReading = 1;
delay(TRG_DUR);
digitalWriteFast(TRG_OUT, HIGH);
digitalWriteFast(TRG_OUT, !LOGIC);
Serial.println("Trig'd!");
}

View file

@ -23,7 +23,7 @@ int VFol = 0;
// 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
// Serial Input Parsing Variables