From 36b6402b2e1bf0a174e935cc42dd0559d939d87c Mon Sep 17 00:00:00 2001 From: loredan13 Date: Thu, 6 Feb 2020 19:06:46 +0300 Subject: [PATCH] Attempt at fixing compile error --- .../src/pP_config.cpp | 12 ----- .../Pyr0_Piezo_Sensor_v2.x.x/src/pP_config.h | 48 +++++-------------- .../src/pP_function.h | 1 + 3 files changed, 14 insertions(+), 47 deletions(-) diff --git a/firmware/AVR-Source/Pyr0_Piezo_Sensor_v2.x.x/src/pP_config.cpp b/firmware/AVR-Source/Pyr0_Piezo_Sensor_v2.x.x/src/pP_config.cpp index f284b6e..d7225ca 100644 --- a/firmware/AVR-Source/Pyr0_Piezo_Sensor_v2.x.x/src/pP_config.cpp +++ b/firmware/AVR-Source/Pyr0_Piezo_Sensor_v2.x.x/src/pP_config.cpp @@ -2,18 +2,6 @@ #include "pP_function.h" #include -int GAIN_FACTOR = GAIN_FACTOR_DEFAULT; // Gain adjustment factor. 0=3x, 1=3.5x, 2=4.33x, 3=6x, 4=11x -int followerThrs = FOLLOWER_THRESHOLD_DEFAULT; -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 -int LOGIC = LOGIC_DEFAULT; // Trigger output logic (active low or active high) -int PZDET = PZDET_DEFAULT; // Enable/disable piezo connection detection -int Debug = 0; -long voltMeterConstant = VM_CONST_DEFAULT; -uint8_t pP_i2c_address = 0xa0; - /*------------------------------------------------*/ void eraseEEPROM() { diff --git a/firmware/AVR-Source/Pyr0_Piezo_Sensor_v2.x.x/src/pP_config.h b/firmware/AVR-Source/Pyr0_Piezo_Sensor_v2.x.x/src/pP_config.h index abe8a97..92d31e9 100644 --- a/firmware/AVR-Source/Pyr0_Piezo_Sensor_v2.x.x/src/pP_config.h +++ b/firmware/AVR-Source/Pyr0_Piezo_Sensor_v2.x.x/src/pP_config.h @@ -5,71 +5,49 @@ #define GAIN_FACTOR_DEFAULT 2 // Gain adjustment factor. 0=3x, 1=3.5x, 2=4.33x, 3=6x, 4=11x #define GAIN_FACTOR_ADDRESS 0 -#if !(defined(GAIN_FACTOR)) - extern int GAIN_FACTOR; -#endif +int GAIN_FACTOR = GAIN_FACTOR_DEFAULT; #define FOLLOWER_THRESHOLD_DEFAULT 1450 // Voltage follower default voltage in mV #define FOLLOWER_THRESHOLD_ADDRESS 4 -#if !(defined(followerThrs)) - extern int followerThrs; -#endif +int followerThrs = 1450; #define COMP_THRESHOLD_DEFAULT 2850 // Comparatore Vref default voltage in mV #define COMP_THRESHOLD_ADDRESS 8 -#if !(defined(compThrs)) - extern int compThrs; -#endif +int compThrs = COMP_THRESHOLD_DEFAULT; #ifndef InitCount - #define InitCount 6 // Number of times to blink the LED on start +#define InitCount 6 // Number of times to blink the LED on start #endif #define LOOP_DUR_DEFAULT 50 // duration of time between ADC checks and other loop functions #define LOOP_DUR_ADDRESS 12 -#if !(defined(LOOP_DUR)) - extern int LOOP_DUR; -#endif +int LOOP_DUR = LOOP_DUR_DEFAULT; #define TRG_DUR_DEFAULT 20 // duration of the Z-axis pulse sent, in ms #define TRG_DUR_ADDRESS 16 -#if !(defined(TRG_DUR)) - extern int TRG_DUR; -#endif +int TRG_DUR = TRG_DUR_DEFAULT; #define HYST_DEFAULT 20 #define HYST_ADDRESS 20 -#if !(defined(Hyst)) - extern int Hyst; // Hysteresis value for ADC measurements -#endif +int Hyst = HYST_DEFAULT; // Hysteresis value for ADC measurements #define LOGIC_DEFAULT 1 #define LOGIC_ADDRESS 32 -#if !(defined(LOGIC)) - extern int LOGIC; // Trigger logic scheme, Active LOW is default -#endif +int LOGIC = LOGIC_DEFAULT; // Trigger logic scheme, Active LOW is default #define PZDET_DEFAULT 0 #define PZDET_ADDRESS 26 -#if !(defined(PZDET)) - extern int PZDET; // Enable or disable piezo connection detection, default is off -#endif +int PZDET = PZDET_DEFAULT; // Enable or disable piezo connection detection, default is off -#if !(defined(Debug)) - extern int Debug; -#endif +int Debug = 0; #define VM_CONST_ADDRESS 28 #define VM_CONST_DEFAULT 1125300L -#if !(defined(voltMeterConstant)) - extern long voltMeterConstant; // For fine tuning input voltage sense -#endif +long voltMeterConstant = VM_CONST_DEFAULT; // For fine tuning input voltage sense #ifdef I2C_INPUT - #define I2C_SLAVE_ADDRESS 24 - #if !(defined(pP_i2c_address)) - extern uint8_t pP_i2c_address; // I2C Bus Address - #endif +#define I2C_SLAVE_ADDRESS 24 +uint8_t pP_i2c_address = 0xa0; // I2C Bus Address #endif // I2C_INPUT void eraseEEPROM(); diff --git a/firmware/AVR-Source/Pyr0_Piezo_Sensor_v2.x.x/src/pP_function.h b/firmware/AVR-Source/Pyr0_Piezo_Sensor_v2.x.x/src/pP_function.h index 612d697..5bc2061 100644 --- a/firmware/AVR-Source/Pyr0_Piezo_Sensor_v2.x.x/src/pP_function.h +++ b/firmware/AVR-Source/Pyr0_Piezo_Sensor_v2.x.x/src/pP_function.h @@ -10,6 +10,7 @@ #define PP_FUNCTION_H #include "Arduino.h" +#include "pP_config.h" #include "pP_volatile.h" #include "pP_pins.h" #include "stdint.h"