Skip to content

Commit

Permalink
Update examples
Browse files Browse the repository at this point in the history
  • Loading branch information
mairas committed Jun 1, 2024
1 parent a6d4706 commit 17ccf34
Show file tree
Hide file tree
Showing 20 changed files with 31 additions and 59 deletions.
4 changes: 1 addition & 3 deletions examples/analog_input.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@ reactesp::ReactESP app;
// The setup function performs one-time application initialization.
void setup() {
// Some initialization boilerplate when in debug mode...
#ifndef SERIAL_DEBUG_DISABLED
SetupSerialDebug(115200);
#endif
SetupLogging();

// Create the global SensESPApp() object.
SensESPAppBuilder builder;
Expand Down
5 changes: 1 addition & 4 deletions examples/async_repeat_sensor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,7 @@ reactesp::ReactESP app;

// The setup function performs one-time application initialization.
void setup() {
// Some initialization boilerplate when in debug mode...
#ifndef SERIAL_DEBUG_DISABLED
SetupSerialDebug(115200);
#endif
SetupLogging();

// Create the global SensESPApp() object.
SensESPAppBuilder builder;
Expand Down
2 changes: 1 addition & 1 deletion examples/chain_counter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ using namespace sensesp;
ReactESP app;

void setup() {
SetupSerialDebug(115200);
SetupLogging();

SensESPAppBuilder builder;
sensesp_app = builder.set_hostname("ChainCounter")
Expand Down
5 changes: 1 addition & 4 deletions examples/constant_sensor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,7 @@ using namespace sensesp;
reactesp::ReactESP app;

void setup() {
// Some initialization boilerplate when in debug mode...
#ifndef SERIAL_DEBUG_DISABLED
SetupSerialDebug(115200);
#endif
SetupLogging();

// Create the builder object
SensESPAppBuilder builder;
Expand Down
5 changes: 1 addition & 4 deletions examples/freertos_tasks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,7 @@ void ToggleTestOutputPin(void *parameter) {

// The setup function performs one-time application initialization.
void setup() {
// Some initialization boilerplate when in debug mode...
#ifndef SERIAL_DEBUG_DISABLED
SetupSerialDebug(115200);
#endif
SetupLogging();

SensESPMinimalAppBuilder builder;
SensESPMinimalApp *sensesp_app = builder.set_hostname("async")->get_app();
Expand Down
4 changes: 1 addition & 3 deletions examples/fuel_level_sensor/fuel_level_sensor_example.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@ using namespace sensesp;
ReactESP app;

void setup() {
#ifndef SERIAL_DEBUG_DISABLED
SetupSerialDebug(115200);
#endif
SetupLogging();

// Set up sensesp
SensESPAppBuilder builder;
Expand Down
2 changes: 1 addition & 1 deletion examples/hysteresis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ using namespace sensesp;
ReactESP app;

void setup() {
SetupSerialDebug(115200);
SetupLogging();

SensESPAppBuilder builder;
sensesp_app = builder.set_hostname("sensesp-hysteresis-example")
Expand Down
2 changes: 1 addition & 1 deletion examples/lambda_transform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ using namespace sensesp;
ReactESP app;

void setup() {
SetupSerialDebug(115200);
SetupLogging();

// Create a new SensESPApp object. This is the direct constructor call, and
// an equivalent alternative to using the SensESPAppBuilder class.
Expand Down
2 changes: 1 addition & 1 deletion examples/manual_networking.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const uint8_t input_pin1 = 0;
ReactESP app;

void setup() {
SetupSerialDebug(115200);
SetupLogging();

SensESPMinimalAppBuilder builder;
auto sensesp_app = builder.set_hostname("counter-test")->get_app();
Expand Down
4 changes: 1 addition & 3 deletions examples/milone_level_sensor/milone_level_sensor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,7 @@ ReactESP app;

void setup() {
// Some initialization boilerplate when in debug mode...
#ifndef SERIAL_DEBUG_DISABLED
SetupSerialDebug(115200);
#endif
SetupLogging();

// Create a builder object
SensESPAppBuilder builder;
Expand Down
2 changes: 1 addition & 1 deletion examples/minimal_app.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const uint8_t output_pin2 = 21;
ReactESP app;

void setup() {
SetupSerialDebug(115200);
SetupLogging();

SensESPMinimalAppBuilder builder;
auto sensesp_app = builder.set_hostname("counter-test")->get_app();
Expand Down
16 changes: 12 additions & 4 deletions examples/platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

[platformio]
;set default_envs to whichever board(s) you use. Build/Run/etc processes those envs
default_envs =
default_envs =
esp32dev

[env]
Expand Down Expand Up @@ -46,11 +46,19 @@ monitor_filters = esp32_exception_decoder
[env:esp32dev]
extends = espressif32_base
board = esp32dev
; Verify that this is the correct pin number for your board!
build_flags =

build_flags =
; Verify that this is the correct pin number for your board!
-D LED_BUILTIN = 2
; Max (and default) debugging level in Arduino ESP32 Core
-D CORE_DEBUG_LEVEL=ARDUHAL_LOG_LEVEL_VERBOSE
; Arduino Core bug workaround: define the log tag for the Arduino
; logging macros.
-D TAG='"Arduino"'
; Use the ESP-IDF logging library - required by SensESP.
-D USE_ESP_IDF_LOG

; uncomment and change these if PlatformIO can't auto-detect
; the ports
;upload_port = /dev/tty.SLAB_USBtoUART
;monitor_port = /dev/tty.SLAB_USBtoUART

4 changes: 1 addition & 3 deletions examples/raw_json.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@ reactesp::ReactESP app;
ObservableValue<bool> toggler;

void setup() {
#ifndef SERIAL_DEBUG_DISABLED
SetupSerialDebug(115200);
#endif
SetupLogging();

SensESPAppBuilder builder;
SensESPApp *sensesp_app = builder.set_hostname("json_demo")
Expand Down
4 changes: 1 addition & 3 deletions examples/relay_control.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@ ReactESP app;

void setup() {
// Some initialization boilerplate when in debug mode...
#ifndef SERIAL_DEBUG_DISABLED
SetupSerialDebug(115200);
#endif
SetupLogging();

// Create a builder object
SensESPAppBuilder builder;
Expand Down
5 changes: 1 addition & 4 deletions examples/repeat_sensor_analog_input.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,7 @@ float analog_read_callback() { return analogRead(kAnalogInputPin) / 4096.0; }

// The setup function performs one-time application initialization.
void setup() {
// Some initialization boilerplate when in debug mode...
#ifndef SERIAL_DEBUG_DISABLED
SetupSerialDebug(115200);
#endif
SetupLogging();

// Create the global SensESPApp() object.
SensESPAppBuilder builder;
Expand Down
4 changes: 1 addition & 3 deletions examples/rpm_counter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@ using namespace sensesp;
ReactESP app;

void setup() {
#ifndef SERIAL_DEBUG_DISABLED
SetupSerialDebug(115200);
#endif
SetupLogging();

SensESPAppBuilder builder;
sensesp_app = builder.get_app();
Expand Down
5 changes: 1 addition & 4 deletions examples/smart_switch/remote_switch_example.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,7 @@ using namespace sensesp;
ReactESP app;

void setup() {
// Some initialization boilerplate when in debug mode...
#ifndef SERIAL_DEBUG_DISABLED
SetupSerialDebug(115200);
#endif
SetupLogging();

// Create a builder object
SensESPAppBuilder builder;
Expand Down
5 changes: 1 addition & 4 deletions examples/smart_switch/smart_switch_example.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,7 @@ using namespace sensesp;
ReactESP app;

void setup() {
// Some initialization boilerplate when in debug mode...
#ifndef SERIAL_DEBUG_DISABLED
SetupSerialDebug(115200);
#endif
SetupLogging();

// Create a builder object
SensESPAppBuilder builder;
Expand Down
5 changes: 1 addition & 4 deletions examples/temperature_sender.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,7 @@ class TemperatureInterpreter : public CurveInterpolator {
ReactESP app;

void setup() {
// Some initialization boilerplate when in debug mode...
#ifndef SERIAL_DEBUG_DISABLED
SetupSerialDebug(115200);
#endif
SetupLogging();

// Create the global SensESPApp() object by first creating a
// SensESPAppBuilder object, then setting some hard-coded
Expand Down
5 changes: 1 addition & 4 deletions examples/time_counter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,7 @@ unsigned long freq_start_time = 0;
int freq = 0;

void setup() {
// Some initialization boilerplate when in debug mode...
#ifndef SERIAL_DEBUG_DISABLED
SetupSerialDebug(115200);
#endif
SetupLogging();

// Create the builder object
SensESPAppBuilder builder;
Expand Down

0 comments on commit 17ccf34

Please sign in to comment.