From 0caeec996e91c197b7bfc02bd223afbaab5f1cb9 Mon Sep 17 00:00:00 2001 From: Ondrej Trochta Date: Thu, 26 Sep 2024 20:58:31 +0200 Subject: [PATCH] test chata --- Arduino-GSM-Chata.code-workspace | 14 ++++++++++++++ lib/Data/GSMMobileData.cpp | 12 +----------- lib/Data/PinTypeOut.cpp | 1 - lib/Data/WebServerData.cpp | 3 ++- lib/Data/WebServerData.h | 5 +++-- lib/Device/WebServer.cpp | 3 ++- lib/Device/WebServer.h | 5 +++-- platformio.ini | 9 +++++---- src/main.cpp | 27 ++++++++++++--------------- 9 files changed, 42 insertions(+), 37 deletions(-) create mode 100644 Arduino-GSM-Chata.code-workspace diff --git a/Arduino-GSM-Chata.code-workspace b/Arduino-GSM-Chata.code-workspace new file mode 100644 index 0000000..91479a6 --- /dev/null +++ b/Arduino-GSM-Chata.code-workspace @@ -0,0 +1,14 @@ +{ + "folders": [ + { + "name": "Arduino-GSM-Chata", + "path": "." + } + ], + "settings": { + "files.associations": { + "pinsdefinitions": "c", + "new": "cpp" + } + } +} \ No newline at end of file diff --git a/lib/Data/GSMMobileData.cpp b/lib/Data/GSMMobileData.cpp index 7a572ad..ba6b5a0 100644 --- a/lib/Data/GSMMobileData.cpp +++ b/lib/Data/GSMMobileData.cpp @@ -3,7 +3,7 @@ #include "GSMMobileData.h" #include "EEPROMUtils.h" #include "DeviceBase.h" -#include "DebugLog.h" + GSMMobileData::GSMMobileData(String id) : DeviceBase(id) { @@ -15,10 +15,6 @@ void GSMMobileData::readAllData(String id) EEPROMUtils eepromUtils = EEPROMUtils(); MobileNumber = eepromUtils.readString(1, 20); Sms = eepromUtils.readString(21, 100); - -#ifdef DEBUG - DebugLog::log("Load from EEPROM. Mobile Number: " + MobileNumber + " SMS: " + Sms); -#endif } void GSMMobileData::updateMobileNumber(const String &newMobileNumber) @@ -33,9 +29,6 @@ void GSMMobileData::updateMobileNumber(const String &newMobileNumber) EEPROMUtils eepromUtils = EEPROMUtils(); MobileNumber = newMobileNumber; eepromUtils.writeString(1, newMobileNumber, 20); -#ifdef DEBUG - DebugLog::log("Update Mobile Number: " + newMobileNumber); -#endif } } @@ -50,8 +43,5 @@ void GSMMobileData::updateSMS(const String &newSMS) EEPROMUtils eepromUtils = EEPROMUtils(); Sms = newSMS; eepromUtils.writeString(21, newSMS, 100); -#ifdef DEBUG - DebugLog::log("Update sms: " + newSMS); -#endif } } diff --git a/lib/Data/PinTypeOut.cpp b/lib/Data/PinTypeOut.cpp index e238d15..51e05ce 100644 --- a/lib/Data/PinTypeOut.cpp +++ b/lib/Data/PinTypeOut.cpp @@ -1,6 +1,5 @@ #include "PinTypeOut.h" #include -#include "DebugLog.h" void PinTypeOut::setOutputSignalToHigh() diff --git a/lib/Data/WebServerData.cpp b/lib/Data/WebServerData.cpp index 063bf28..4e4fb77 100644 --- a/lib/Data/WebServerData.cpp +++ b/lib/Data/WebServerData.cpp @@ -1,4 +1,4 @@ -#include +/*#include #include #include @@ -46,3 +46,4 @@ String WebServerData::removeAllCharactersAfterEmptySpace(String &data) data.replace("_", " "); return data; } +*/ \ No newline at end of file diff --git a/lib/Data/WebServerData.h b/lib/Data/WebServerData.h index 24a047c..273ebd8 100644 --- a/lib/Data/WebServerData.h +++ b/lib/Data/WebServerData.h @@ -1,4 +1,4 @@ -#ifndef WebServerData_H +/*ifndef WebServerData_H #define WebServerData_H #include @@ -19,4 +19,5 @@ public: }; -#endif // WebServerData_H \ No newline at end of file +#endif // WebServerData_H +*/ \ No newline at end of file diff --git a/lib/Device/WebServer.cpp b/lib/Device/WebServer.cpp index 53ae6fa..7d1dcbc 100644 --- a/lib/Device/WebServer.cpp +++ b/lib/Device/WebServer.cpp @@ -1,4 +1,4 @@ -#include +/*#include #include #include "WebServer.h" #include "WebServerData.h" @@ -134,3 +134,4 @@ void WebServer::SendToBrowser(const String &dataString) } client.println(""); } +*/ \ No newline at end of file diff --git a/lib/Device/WebServer.h b/lib/Device/WebServer.h index 46f3882..d9f8f53 100644 --- a/lib/Device/WebServer.h +++ b/lib/Device/WebServer.h @@ -1,4 +1,4 @@ -#ifndef WebServer_H +/*#ifndef WebServer_H #define WebServer_H #include @@ -23,4 +23,5 @@ private: void SendToBrowser(const String &dataString); }; -#endif // WebServer_H \ No newline at end of file +#endif // WebServer_H +*/ \ No newline at end of file diff --git a/platformio.ini b/platformio.ini index e79bd8e..bea0a82 100644 --- a/platformio.ini +++ b/platformio.ini @@ -12,8 +12,9 @@ platform = atmelavr board = uno framework = arduino -lib_deps = - arduino-libraries/Ethernet@^2.0.2 - featherfly/SoftwareSerial@^1.0 +debug_tool = avr-stub +debug_port = COM8 +monitor_port = COM8 monitor_speed = 115200 - +lib_deps = + jdolinay/avr-debugger@^1.5 diff --git a/src/main.cpp b/src/main.cpp index 4027f7b..56fbf77 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,14 +1,15 @@ #include "GSMMobileDevice.h" -#include "WebServer.h" +//#include "WebServer.h" #include "PinTypeIn.h" #include "PinTypeOut.h" #include -#include -#include -#include "WebServer.h" -#include "WebServerData.h" -#include "DebugLog.h" -#include "HTMLGenerator.h" +//#include +// #include +// #include "WebServer.h" +// #include "WebServerData.h" + +//#include "HTMLGenerator.h" +#include "avr8-stub.h" //#define DEBUG @@ -20,7 +21,7 @@ static const PinTypeOut OUPUTS_PINS_ARRAY[COUNT_OUTPUTS_PIN_OUT] = {PinOutAlarm8 // PIN INPUT Initialization as INPUT static const int COUNT_INPUTS_PIN_IN = 2; -static PinTypeIn PinInEZSAlarm2 = PinTypeIn("PIN2", 2, 100, "Input EZS ALARM"); // 100ms debounce; +static PinTypeIn PinInEZSAlarm2 = PinTypeIn("PIN4", 4, 100, "Input EZS ALARM"); // 100ms debounce; static PinTypeIn PinInCaseOpen3 = PinTypeIn("PIN3", 3, 100, "Input Contact Box"); static const PinTypeIn INPUTS_PINS_ARRAY[COUNT_INPUTS_PIN_IN] = {PinInEZSAlarm2, PinInCaseOpen3}; @@ -35,19 +36,15 @@ GSMMobileData gsmData = GSMMobileData("GSM"); void setup() { -#ifdef DEBUG - DebugLog::init(115200); - DebugLog::log("Called: Setup and init GSM"); - DebugLog::log("Init GSM is OK"); -#endif - // gsmDevice.init(); + debug_init(); + gsmData.MobileNumber = "+420608126674"; gsmData.Sms = "Alarm EZS CHATA"; } void loop() { - DebugLog::log("PIN IN 2: " + String(PinInEZSAlarm2.IsPinHigh())); + ; if (PinInEZSAlarm2.IsPinHigh()) { PinOutAlarm8.setOutputSignalToHigh();