Oups no files
This commit is contained in:
parent
891f2be935
commit
2bbe486c82
57
.clang-format
Normal file
57
.clang-format
Normal file
@ -0,0 +1,57 @@
|
||||
---
|
||||
BasedOnStyle: Mozilla
|
||||
AccessModifierOffset: '-4'
|
||||
AlignAfterOpenBracket: Align
|
||||
AlignConsecutiveAssignments: 'true'
|
||||
AlignConsecutiveDeclarations: 'true'
|
||||
AlignOperands: 'true'
|
||||
AlignTrailingComments: 'true'
|
||||
AllowAllParametersOfDeclarationOnNextLine: 'true'
|
||||
AllowShortBlocksOnASingleLine: 'true'
|
||||
AllowShortCaseLabelsOnASingleLine: 'false'
|
||||
AllowShortFunctionsOnASingleLine: Empty
|
||||
AllowShortLoopsOnASingleLine: 'false'
|
||||
AlwaysBreakAfterDefinitionReturnType: None
|
||||
AlwaysBreakAfterReturnType: None
|
||||
BreakBeforeBinaryOperators: All
|
||||
BreakBeforeBraces: Allman
|
||||
BreakBeforeTernaryOperators: 'true'
|
||||
BreakConstructorInitializers: AfterColon
|
||||
BreakStringLiterals: 'false'
|
||||
ColumnLimit: '100'
|
||||
ConstructorInitializerAllOnOneLineOrOnePerLine: 'false'
|
||||
ConstructorInitializerIndentWidth: '0'
|
||||
ContinuationIndentWidth: '4'
|
||||
Cpp11BracedListStyle: 'false'
|
||||
DerivePointerAlignment: 'false'
|
||||
DisableFormat: 'false'
|
||||
ExperimentalAutoDetectBinPacking: 'true'
|
||||
IndentCaseLabels: 'true'
|
||||
IndentWidth: '4'
|
||||
IndentWrappedFunctionNames: 'false'
|
||||
JavaScriptQuotes: Single
|
||||
KeepEmptyLinesAtTheStartOfBlocks: 'false'
|
||||
Language: Cpp
|
||||
MaxEmptyLinesToKeep: '2'
|
||||
NamespaceIndentation: None
|
||||
ObjCBlockIndentWidth: '4'
|
||||
ObjCSpaceAfterProperty: 'false'
|
||||
ObjCSpaceBeforeProtocolList: 'false'
|
||||
PointerAlignment: Left
|
||||
ReflowComments: 'true'
|
||||
SortIncludes: 'false'
|
||||
SpaceAfterCStyleCast: 'true'
|
||||
SpaceBeforeAssignmentOperators: 'true'
|
||||
SpaceBeforeParens: ControlStatements
|
||||
SpaceInEmptyParentheses: 'false'
|
||||
SpacesBeforeTrailingComments: '2'
|
||||
SpacesInAngles: 'false'
|
||||
SpacesInCStyleCastParentheses: 'false'
|
||||
SpacesInContainerLiterals: 'false'
|
||||
SpacesInParentheses: 'false'
|
||||
SpacesInSquareBrackets: 'false'
|
||||
Standard: Cpp11
|
||||
TabWidth: '4'
|
||||
UseTab: Always
|
||||
|
||||
...
|
37
include/README
Normal file
37
include/README
Normal file
@ -0,0 +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
|
61
include/config.h
Normal file
61
include/config.h
Normal file
@ -0,0 +1,61 @@
|
||||
// AHT20 SENSOR ENABLE / DISABLE
|
||||
#define AHT20_ENABLE true
|
||||
|
||||
// SGP40 SENSOR ENABLE / DISABLE
|
||||
#define SGP40_ENABLE true
|
||||
|
||||
// BH1750 SENSOR ENABLE / DISABLE
|
||||
#define BH1750_ENABLE true
|
||||
|
||||
// BATTERY TESTING ENABLE / DISABLE
|
||||
#define BAT_TEST_ENABLE true
|
||||
|
||||
// Thingsboard library debug
|
||||
#define THINGSBOARD_ENABLE_DEBUG true
|
||||
|
||||
// Serial debug output
|
||||
#define SERIAL_DEBUG true
|
||||
#if SERIAL_DEBUG
|
||||
#define SERIAL_PRINT_SENSOR_VALUES false
|
||||
#endif
|
||||
|
||||
constexpr char WIFI_SSID[] = "thingsboard";
|
||||
constexpr char WIFI_PASSWORD[] = "thingsboard";
|
||||
|
||||
// See https://thingsboard.io/docs/getting-started-guides/helloworld/
|
||||
// to understand how to obtain an access token
|
||||
constexpr char TOKEN[] = "HOMECTRL";
|
||||
// constexpr char mqtt_attribute_topic[] = "v1/devices/me/attributes";
|
||||
|
||||
// Thingsboard we want to establish a connection too
|
||||
constexpr char THINGSBOARD_SERVER[] = "10.42.0.1";
|
||||
|
||||
// Whether the given script is using encryption or not,
|
||||
// generally recommended as it increases security (communication with the server is not in clear
|
||||
// text anymore), it does come with an overhead tough as having an encrypted session requires a lot
|
||||
// of memory, which might not be avaialable on lower end devices.
|
||||
#define ENCRYPTED false
|
||||
|
||||
// While we wait for Feather ESP32 V2 to get added to the Espressif BSP,
|
||||
// we have to select PICO D4 and UNCOMMENT this line!
|
||||
#define ADAFRUIT_FEATHER_ESP32_V2
|
||||
|
||||
// Sending data can either be done over MQTT and the PubSubClient
|
||||
// or HTTPS and the HTTPClient, when using the ESP32 or ESP8266
|
||||
#define USING_HTTPS false
|
||||
|
||||
// Enables the ThingsBoard class to be fully dynamic instead of requiring template arguments to
|
||||
// statically allocate memory. If enabled the program might be slightly slower and all the memory
|
||||
// will be placed onto the heap instead of the stack.
|
||||
#define THINGSBOARD_ENABLE_DYNAMIC 1
|
||||
|
||||
// If the THINGSBOARD_ENABLE_DYNAMIC 1 setting causes this error log message to appear [TB] Unable
|
||||
// to de-serialize received json data with error (DeserializationError::NoMemory). Simply add this
|
||||
// configuration line as well.
|
||||
// #define THINGSBOARD_ENABLE_PSRAM 0
|
||||
|
||||
// Enables sending messages that are bigger than the predefined message size,
|
||||
// where the message will be sent byte by byte as a fallback instead.
|
||||
// Requires an additional library, see https://github.com/bblanchon/ArduinoStreamUtils for more
|
||||
// information. Simply install that library and the feature will be enabled automatically.
|
||||
#define THINGSBOARD_ENABLE_STREAM_UTILS 0
|
1
include/version.h
Normal file
1
include/version.h
Normal file
@ -0,0 +1 @@
|
||||
#define VERSION "0.0.2"
|
46
lib/README
Normal file
46
lib/README
Normal file
@ -0,0 +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 <Foo.h>
|
||||
#include <Bar.h>
|
||||
|
||||
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
|
21
platformio.ini
Normal file
21
platformio.ini
Normal file
@ -0,0 +1,21 @@
|
||||
; 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 = https://github.com/pioarduino/platform-espressif32/releases/download/stable/platform-espressif32.zip
|
||||
board = adafruit_feather_esp32_v2
|
||||
framework = arduino
|
||||
lib_deps =
|
||||
thingsboard/ThingsBoard@^0.15.0
|
||||
adafruit/Adafruit AHTX0@^2.0.5
|
||||
adafruit/Adafruit SGP40 Sensor@^1.1.3
|
||||
adafruit/Adafruit NeoPixel@^1.12.5
|
||||
starmbi/hp_BH1750@^1.0.2
|
||||
upload_port = /dev/cu.usbserial-59170079101
|
41
src/main.cpp
Normal file
41
src/main.cpp
Normal file
@ -0,0 +1,41 @@
|
||||
#include "config.h"
|
||||
#include "version.h"
|
||||
|
||||
#include "driver/rtc_io.h"
|
||||
|
||||
#define USE_EXT0_WAKEUP 0
|
||||
|
||||
#include <WiFi.h>
|
||||
#include <WiFiClientSecure.h>
|
||||
#include <Adafruit_NeoPixel.h>
|
||||
|
||||
#include <Arduino_MQTT_Client.h>
|
||||
#include <ThingsBoard.h>
|
||||
|
||||
// AHT20 Temperature & Humidity sensor
|
||||
#if AHT20_ENABLE
|
||||
#include <Adafruit_AHTX0.h>
|
||||
#endif
|
||||
|
||||
// SGP40 Air Quality Sensor
|
||||
#if SGP40_ENABLE
|
||||
#include <Adafruit_SGP40.h>
|
||||
#endif
|
||||
|
||||
// BH1750 Luxmeter
|
||||
#if BH1750_ENABLE
|
||||
#include <hp_BH1750.h>
|
||||
#endif
|
||||
|
||||
// Battery pin
|
||||
#define VBATPIN A13
|
||||
|
||||
|
||||
|
||||
void setup()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void loop() {}
|
||||
|
Loading…
x
Reference in New Issue
Block a user