Merge branch 'develop' of https://github.com/pyr0ball/pyr0piezo into develop
This commit is contained in:
commit
7577694208
6 changed files with 33 additions and 33 deletions
|
|
@ -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
|
|
||||||
}
|
|
||||||
|
|
@ -8,19 +8,24 @@
|
||||||
; Please visit documentation for the other options and examples
|
; Please visit documentation for the other options and examples
|
||||||
; https://docs.platformio.org/page/projectconf.html
|
; https://docs.platformio.org/page/projectconf.html
|
||||||
|
|
||||||
|
[platformio]
|
||||||
|
default_envs = ATmega328PB
|
||||||
|
|
||||||
[env:ATmega88P]
|
[env:ATmega88P]
|
||||||
platform = atmelavr
|
platform = atmelavr
|
||||||
board = ATmega88P
|
board = ATmega88P
|
||||||
framework = arduino
|
framework = arduino
|
||||||
|
lib_deps = Arduino
|
||||||
upload_protocol = stk500v1
|
upload_protocol = stk500v1
|
||||||
; each flag in a new line
|
; each flag in a new line
|
||||||
upload_flags =
|
upload_flags =
|
||||||
-P$UPLOAD_PORT
|
-P$UPLOAD_PORT
|
||||||
-b$UPLOAD_SPEED
|
-b$UPLOAD_SPEED
|
||||||
|
-fmax_errors=5
|
||||||
|
|
||||||
; edit these lines
|
; edit these lines
|
||||||
upload_port = COM4
|
; upload_port = COM4
|
||||||
upload_speed = 19200
|
upload_speed = 38400
|
||||||
|
|
||||||
board_build.f_cpu = 8000000L
|
board_build.f_cpu = 8000000L
|
||||||
board_fuses.lfuse = "0xE2"
|
board_fuses.lfuse = "0xE2"
|
||||||
|
|
@ -31,14 +36,16 @@ board_fuses.efuse = "0xF9"
|
||||||
platform = atmelavr
|
platform = atmelavr
|
||||||
board = ATmega328PB
|
board = ATmega328PB
|
||||||
framework = arduino
|
framework = arduino
|
||||||
|
lib_deps = Arduino
|
||||||
upload_protocol = stk500v1
|
upload_protocol = stk500v1
|
||||||
; each flag in a new line
|
; each flag in a new line
|
||||||
upload_flags =
|
upload_flags =
|
||||||
-P$UPLOAD_PORT
|
-P$UPLOAD_PORT
|
||||||
-b$UPLOAD_SPEED
|
-b$UPLOAD_SPEED
|
||||||
|
-fmax_errors=5
|
||||||
|
|
||||||
; edit these lines
|
; edit these lines
|
||||||
upload_port = COM4
|
;upload_port = COM4
|
||||||
upload_speed = 19200
|
upload_speed = 38400
|
||||||
|
|
||||||
board_build.f_cpu = 8000000L
|
board_build.f_cpu = 8000000L
|
||||||
|
|
@ -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