From 836c464629c5bd689f0b8acddab73b5df6de7abb Mon Sep 17 00:00:00 2001 From: Sam Rolfe Date: Fri, 25 Sep 2026 20:39:39 +1000 Subject: [PATCH] Initial commit (secrets isolated) --- .gitignore | 8 ++ Lora Transmitter type 01/.gitignore | 5 - .../.vscode/extensions.json | 10 -- .../include => include}/README | 74 +++++++-------- {Lora Transmitter type 01/lib => lib}/README | 92 +++++++++---------- .../platformio.ini => platformio.ini | 36 ++++---- secrets.h.example | 9 ++ .../src => src}/main.cpp | 9 +- .../test => test}/README | 22 ++--- 9 files changed, 134 insertions(+), 131 deletions(-) create mode 100755 .gitignore delete mode 100644 Lora Transmitter type 01/.gitignore delete mode 100644 Lora Transmitter type 01/.vscode/extensions.json rename {Lora Transmitter type 01/include => include}/README (97%) mode change 100644 => 100755 rename {Lora Transmitter type 01/lib => lib}/README (95%) mode change 100644 => 100755 rename Lora Transmitter type 01/platformio.ini => platformio.ini (96%) mode change 100644 => 100755 create mode 100644 secrets.h.example rename {Lora Transmitter type 01/src => src}/main.cpp (97%) mode change 100644 => 100755 rename {Lora Transmitter type 01/test => test}/README (97%) mode change 100644 => 100755 diff --git a/.gitignore b/.gitignore new file mode 100755 index 0000000..d7f308a --- /dev/null +++ b/.gitignore @@ -0,0 +1,8 @@ +secrets.h +.pio/ +build/ +.vscode/ +.idea/ +*.bin +*.elf +*.hex diff --git a/Lora Transmitter type 01/.gitignore b/Lora Transmitter type 01/.gitignore deleted file mode 100644 index 89cc49c..0000000 --- a/Lora Transmitter type 01/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -.pio -.vscode/.browse.c_cpp.db* -.vscode/c_cpp_properties.json -.vscode/launch.json -.vscode/ipch diff --git a/Lora Transmitter type 01/.vscode/extensions.json b/Lora Transmitter type 01/.vscode/extensions.json deleted file mode 100644 index 080e70d..0000000 --- a/Lora Transmitter type 01/.vscode/extensions.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - // See http://go.microsoft.com/fwlink/?LinkId=827846 - // for the documentation about the extensions.json format - "recommendations": [ - "platformio.platformio-ide" - ], - "unwantedRecommendations": [ - "ms-vscode.cpptools-extension-pack" - ] -} diff --git a/Lora Transmitter type 01/include/README b/include/README old mode 100644 new mode 100755 similarity index 97% rename from Lora Transmitter type 01/include/README rename to include/README index 49819c0..630164d --- a/Lora Transmitter type 01/include/README +++ b/include/README @@ -1,37 +1,37 @@ - -This directory is intended for project header files. - -A header file is a file containing C declarations and macro definitions -to be shared between several project source files. You request the use of a -header file in your project source file (C, C++, etc) located in `src` folder -by including it, with the C preprocessing directive `#include'. - -```src/main.c - -#include "header.h" - -int main (void) -{ - ... -} -``` - -Including a header file produces the same results as copying the header file -into each source file that needs it. Such copying would be time-consuming -and error-prone. With a header file, the related declarations appear -in only one place. If they need to be changed, they can be changed in one -place, and programs that include the header file will automatically use the -new version when next recompiled. The header file eliminates the labor of -finding and changing all the copies as well as the risk that a failure to -find one copy will result in inconsistencies within a program. - -In C, the convention is to give header files names that end with `.h'. - -Read more about using header files in official GCC documentation: - -* Include Syntax -* Include Operation -* Once-Only Headers -* Computed Includes - -https://gcc.gnu.org/onlinedocs/cpp/Header-Files.html + +This directory is intended for project header files. + +A header file is a file containing C declarations and macro definitions +to be shared between several project source files. You request the use of a +header file in your project source file (C, C++, etc) located in `src` folder +by including it, with the C preprocessing directive `#include'. + +```src/main.c + +#include "header.h" + +int main (void) +{ + ... +} +``` + +Including a header file produces the same results as copying the header file +into each source file that needs it. Such copying would be time-consuming +and error-prone. With a header file, the related declarations appear +in only one place. If they need to be changed, they can be changed in one +place, and programs that include the header file will automatically use the +new version when next recompiled. The header file eliminates the labor of +finding and changing all the copies as well as the risk that a failure to +find one copy will result in inconsistencies within a program. + +In C, the convention is to give header files names that end with `.h'. + +Read more about using header files in official GCC documentation: + +* Include Syntax +* Include Operation +* Once-Only Headers +* Computed Includes + +https://gcc.gnu.org/onlinedocs/cpp/Header-Files.html diff --git a/Lora Transmitter type 01/lib/README b/lib/README old mode 100644 new mode 100755 similarity index 95% rename from Lora Transmitter type 01/lib/README rename to lib/README index 9379397..8d3ee2a --- a/Lora Transmitter type 01/lib/README +++ b/lib/README @@ -1,46 +1,46 @@ - -This directory is intended for project specific (private) libraries. -PlatformIO will compile them to static libraries and link into the executable file. - -The source code of each library should be placed in a separate directory -("lib/your_library_name/[Code]"). - -For example, see the structure of the following example libraries `Foo` and `Bar`: - -|--lib -| | -| |--Bar -| | |--docs -| | |--examples -| | |--src -| | |- Bar.c -| | |- Bar.h -| | |- library.json (optional. for custom build options, etc) https://docs.platformio.org/page/librarymanager/config.html -| | -| |--Foo -| | |- Foo.c -| | |- Foo.h -| | -| |- README --> THIS FILE -| -|- platformio.ini -|--src - |- main.c - -Example contents of `src/main.c` using Foo and Bar: -``` -#include -#include - -int main (void) -{ - ... -} - -``` - -The PlatformIO Library Dependency Finder will find automatically dependent -libraries by scanning project source files. - -More information about PlatformIO Library Dependency Finder -- https://docs.platformio.org/page/librarymanager/ldf.html + +This directory is intended for project specific (private) libraries. +PlatformIO will compile them to static libraries and link into the executable file. + +The source code of each library should be placed in a separate directory +("lib/your_library_name/[Code]"). + +For example, see the structure of the following example libraries `Foo` and `Bar`: + +|--lib +| | +| |--Bar +| | |--docs +| | |--examples +| | |--src +| | |- Bar.c +| | |- Bar.h +| | |- library.json (optional. for custom build options, etc) https://docs.platformio.org/page/librarymanager/config.html +| | +| |--Foo +| | |- Foo.c +| | |- Foo.h +| | +| |- README --> THIS FILE +| +|- platformio.ini +|--src + |- main.c + +Example contents of `src/main.c` using Foo and Bar: +``` +#include +#include + +int main (void) +{ + ... +} + +``` + +The PlatformIO Library Dependency Finder will find automatically dependent +libraries by scanning project source files. + +More information about PlatformIO Library Dependency Finder +- https://docs.platformio.org/page/librarymanager/ldf.html diff --git a/Lora Transmitter type 01/platformio.ini b/platformio.ini old mode 100644 new mode 100755 similarity index 96% rename from Lora Transmitter type 01/platformio.ini rename to platformio.ini index 9d8d47d..43b722a --- a/Lora Transmitter type 01/platformio.ini +++ b/platformio.ini @@ -1,18 +1,18 @@ -; PlatformIO Project Configuration File -; -; Build options: build flags, source filter -; Upload options: custom upload port, speed and extra flags -; Library options: dependencies, extra library storages -; Advanced options: extra scripting -; -; Please visit documentation for the other options and examples -; https://docs.platformio.org/page/projectconf.html - -[env:esp32dev] -platform = espressif32 -board = esp32dev -framework = arduino -lib_deps = - knolleary/PubSubClient@^2.8 - bblanchon/ArduinoJson@^7.4.1 - sandeepmistry/LoRa@^0.8.0 +; PlatformIO Project Configuration File +; +; Build options: build flags, source filter +; Upload options: custom upload port, speed and extra flags +; Library options: dependencies, extra library storages +; Advanced options: extra scripting +; +; Please visit documentation for the other options and examples +; https://docs.platformio.org/page/projectconf.html + +[env:esp32dev] +platform = espressif32 +board = esp32dev +framework = arduino +lib_deps = + knolleary/PubSubClient@^2.8 + bblanchon/ArduinoJson@^7.4.1 + sandeepmistry/LoRa@^0.8.0 diff --git a/secrets.h.example b/secrets.h.example new file mode 100644 index 0000000..5ff32d1 --- /dev/null +++ b/secrets.h.example @@ -0,0 +1,9 @@ +#ifndef SECRETS_H +#define SECRETS_H + +#define SECRET_WIFI_SSID "YOUR_WIFI_SSID" +#define SECRET_WIFI_PASS "YOUR_WIFI_PASSWORD" +#define SECRET_MQTT_USER "YOUR_MQTT_USERNAME" +#define SECRET_MQTT_PASS "YOUR_MQTT_PASSWORD" + +#endif diff --git a/Lora Transmitter type 01/src/main.cpp b/src/main.cpp old mode 100644 new mode 100755 similarity index 97% rename from Lora Transmitter type 01/src/main.cpp rename to src/main.cpp index 00e44c6..3dd52b1 --- a/Lora Transmitter type 01/src/main.cpp +++ b/src/main.cpp @@ -1,3 +1,4 @@ +#include "secrets.h" #include #include #include @@ -13,11 +14,11 @@ #define LORA_IRQ 26 // DIO0 (Used by library, not explicitly for interrupts here) // --- WiFi & MQTT Configuration --- -const char* ssid = "Aussie Broadband 8729"; // Replace with your SSID -const char* password = "Ffdfmunfca"; // Replace with your WiFi password +const char* ssid = SECRET_WIFI_SSID; +const char* password = SECRET_WIFI_PASS; const char* mqtt_server = "192.168.20.30"; // Replace with your MQTT broker IP/hostname -const char* mqtt_user = "mqtt-user"; // Replace with your MQTT username (if any) -const char* mqtt_password = "sam4jo"; // Replace with your MQTT password (if any) +const char* mqtt_user = SECRET_MQTT_USER; +const char* password = SECRET_WIFI_PASS; // MQTT Topics const char* mqtt_topic_subscribe = "homeassistant/ESP32_RA/control"; // Topic to receive commands FOR LoRa devices const char* mqtt_topic_publish = "homeassistant/ESP32_RA/state"; // Topic to publish status FROM LoRa devices diff --git a/Lora Transmitter type 01/test/README b/test/README old mode 100644 new mode 100755 similarity index 97% rename from Lora Transmitter type 01/test/README rename to test/README index 9b1e87b..b0416ad --- a/Lora Transmitter type 01/test/README +++ b/test/README @@ -1,11 +1,11 @@ - -This directory is intended for PlatformIO Test Runner and project tests. - -Unit Testing is a software testing method by which individual units of -source code, sets of one or more MCU program modules together with associated -control data, usage procedures, and operating procedures, are tested to -determine whether they are fit for use. Unit testing finds problems early -in the development cycle. - -More information about PlatformIO Unit Testing: -- https://docs.platformio.org/en/latest/advanced/unit-testing/index.html + +This directory is intended for PlatformIO Test Runner and project tests. + +Unit Testing is a software testing method by which individual units of +source code, sets of one or more MCU program modules together with associated +control data, usage procedures, and operating procedures, are tested to +determine whether they are fit for use. Unit testing finds problems early +in the development cycle. + +More information about PlatformIO Unit Testing: +- https://docs.platformio.org/en/latest/advanced/unit-testing/index.html