Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement captive portal #677

Closed
wants to merge 40 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
3ebd8e6
Replace old Async web server with esp-idf httpd
mairas Sep 26, 2023
eb516bd
Use esp-idf websockets library
mairas Sep 28, 2023
7d13ded
Remove the leftover AsyncTCP libraries
mairas Sep 28, 2023
0f649e9
Fix issues brought up by static analysis tools
mairas Nov 26, 2023
fcd3709
Remove the RemoteDebug dependency
mairas Sep 28, 2023
06c1534
Fix a typo in analogvoltage
mairas Oct 4, 2023
fb5694c
Fix editor indentation
mairas Oct 2, 2023
64ca988
Delete old web tree
mairas Sep 28, 2023
323bd39
Add an .eslintrc file
mairas Oct 10, 2023
4a6bd16
Implement new config UI
mairas Sep 28, 2023
bd9f4c3
Add backend API mocking
mairas Oct 1, 2023
7295780
Add SensESP logo
mairas Oct 1, 2023
e32fbd3
Add generated Bootstrap CSS files to .gitignore
mairas Nov 14, 2023
28a5a64
Add a plugin template
mairas Oct 12, 2023
ffe1f7a
Implement dynamic plugin loading
mairas Nov 14, 2023
fa95276
Add "mocked" remote plugin serving
mairas Nov 14, 2023
bbdaefd
Convert frontend dist files to C++ headers
mairas Sep 27, 2023
4e62782
Split the different API handlers into classes of their own
mairas Nov 19, 2023
50d552b
Decode URLs before matching to paths
mairas Feb 7, 2024
62e9901
Fix hostname UIOutput
mairas Feb 5, 2024
1bcda9b
Change UIOutput Json formatting semantics
mairas Nov 26, 2023
32d052c
Implement Configurable::clear_configuration
mairas Jan 5, 2024
6cc7dd7
Implement /api/routes endpoint
mairas Nov 26, 2023
cf6bbf2
Fix config schema handling
mairas Feb 6, 2024
8a7da88
Reimplement WiFi configuration and connection logic
mairas Jan 31, 2024
793e076
Connect all dynamic routes to the default root page
mairas Feb 5, 2024
9a2ff9b
Make hostname a persisting observable
mairas Feb 1, 2024
a63f09f
Fix task queue producer set signature
mairas Feb 2, 2024
7748654
Implement HTTP Digest Authentication
mairas Feb 5, 2024
9bb1d51
Provide SK delta TX and RX counters
mairas Feb 5, 2024
c8417a9
Fix ArduinoJson 7 deprecations
mairas Feb 5, 2024
50bab13
Lock dependency versions; refactor platformio.ini
mairas Feb 7, 2024
c3cfd29
Remove Startable class
mairas Feb 7, 2024
b64f6b9
Rename ValueConsumer::set_input to set
mairas Feb 7, 2024
f9fa536
Bump version: 2.7.1-alpha → 3.0.0-alpha1
mairas Feb 7, 2024
48e0031
Fix ws_client polling memory leak
mairas Feb 7, 2024
50ce192
Make Integrator emit its initial value
mairas Feb 7, 2024
8127bff
Update the examples
mairas Feb 7, 2024
7644575
Rename HTTPServerHandler to HTTPRequestHandler
mairas Feb 8, 2024
6711dd6
Implement a captive portal for the access point
mairas Feb 8, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 2.7.1-alpha
current_version = 3.0.0-alpha1
commit = True
tag = False
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)(\-(?P<release>[a-z]+))?
Expand Down
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ insert_final_newline = true
[Makefile]
indent_style = tab

[*.{c,h,cpp,hpp}]
[*.{c,h,cpp,hpp,js,ts,jsx,tsx,css,scss,html,xml,json,yml,md}]
indent_size = 2
2 changes: 1 addition & 1 deletion Doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ PROJECT_NAME = SensESP
# could be handy for archiving the generated documentation or if some version
# control system is used.

PROJECT_NUMBER = 2.7.1-alpha
PROJECT_NUMBER = 3.0.0-alpha

# Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer a
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.7.1-alpha
3.0.0-alpha
6 changes: 2 additions & 4 deletions examples/analog_input.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@

#include "sensesp/sensors/analog_input.h"

#include <Arduino.h>

#include "sensesp/sensors/analog_input.h"
#include "sensesp/signalk/signalk_output.h"
#include "sensesp/transforms/linear.h"
#include "sensesp_app.h"
Expand Down Expand Up @@ -90,9 +91,6 @@ void setup() {
analog_input->connect_to(new Linear(multiplier, offset, linear_config_path))
->connect_to(new SKOutputFloat(sk_path, "",
new SKMetadata("ratio", "Indoor light")));

// Start the SensESP application running
sensesp_app->start();
}

// The loop function is called in an endless loop during program execution.
Expand Down
3 changes: 0 additions & 3 deletions examples/async_repeat_sensor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,6 @@ void setup() {
// Connect the output of the digital input to the SKOutput object which
// transmits the results to the Signal K server.
digital->connect_to(new SKOutputFloat(sk_path, ""));

// Start the SensESP application running
sensesp_app->start();
}

// The loop function is called in an endless loop during program execution.
Expand Down
11 changes: 4 additions & 7 deletions examples/chain_counter.cpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#include "sensesp_app.h"
#include "sensesp_app_builder.h"
#include "sensesp/sensors/digital_input.h"
#include "sensesp/signalk/signalk_output.h"
#include "sensesp/system/lambda_consumer.h"
#include "sensesp/transforms/debounce.h"
#include "sensesp/transforms/integrator.h"
#include "sensesp_app.h"
#include "sensesp_app_builder.h"

using namespace sensesp;

Expand Down Expand Up @@ -96,8 +96,8 @@ void setup() {
*/
int read_delay = 10;
String read_delay_config_path = "/button_watcher/read_delay";
auto* button_watcher = new DigitalInputChange(
BUTTON_PIN, INPUT, read_delay, read_delay_config_path);
auto* button_watcher = new DigitalInputChange(BUTTON_PIN, INPUT, read_delay,
read_delay_config_path);

/**
* Create a DebounceInt to make sure we get a nice, clean signal from the
Expand Down Expand Up @@ -144,9 +144,6 @@ void setup() {

/* Connect the button_watcher to the debounce to the button_consumer. */
button_watcher->connect_to(debounce)->connect_to(button_consumer);

/* Finally, start the SensESPApp */
sensesp_app->start();
}

// The loop function is called in an endless loop during program execution.
Expand Down
4 changes: 1 addition & 3 deletions examples/constant_sensor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
*/

#include "sensesp/sensors/constant_sensor.h"

#include "sensesp_app_builder.h"

using namespace sensesp;
Expand All @@ -37,9 +38,6 @@ void setup() {
constant_sensor->connect_to(
new SKOutputFloat("tanks.freshWater.capacity", "",
new SKMetadata("m3", "Fresh Water Tank Capacity")));

// Start the SensESP application running
sensesp_app->start();
}

void loop() { app.tick(); }
17 changes: 5 additions & 12 deletions examples/freertos_tasks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,7 @@ void setup() {
SensESPMinimalAppBuilder builder;
SensESPMinimalApp *sensesp_app = builder.set_hostname("async")->get_app();

auto *networking = new Networking(
"/system/net", "", "", SensESPBaseApp::get_hostname(), "thisisfine");
auto *networking = new Networking("/system/net", "", "");
auto *http_server = new HTTPServer();

// create the SK delta object
Expand All @@ -65,7 +64,7 @@ void setup() {
auto *system_status_led = new SystemStatusLed(LED_BUILTIN);

system_status_controller->connect_to(system_status_led);
ws_client_->get_delta_count_producer().connect_to(system_status_led);
ws_client_->get_delta_tx_count_producer().connect_to(system_status_led);

// create a new task for toggling the output pin

Expand All @@ -88,17 +87,11 @@ void setup() {
// create a new SKListener for navigation.headingMagnetic

auto hdg = new SKValueListener<float>("navigation.headingMagnetic");
hdg->connect_to(new LambdaConsumer<float>([](float input) {
debugD("Heading: %f", input);
}));
hdg->connect_to(new LambdaConsumer<float>(
[](float input) { debugD("Heading: %f", input); }));

// print out free heap
app.onRepeat(2000, []() {
debugD("Free heap: %d", ESP.getFreeHeap());
});

// Start the SensESP application running
sensesp_app->start();
app.onRepeat(2000, []() { debugD("Free heap: %d", ESP.getFreeHeap()); });
}

// The loop function is called in an endless loop during program execution.
Expand Down
8 changes: 2 additions & 6 deletions examples/fuel_level_sensor/fuel_level_sensor_example.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "sensesp_app_builder.h"
#include "sensesp/sensors/analog_input.h"
#include "sensesp/signalk/signalk_output.h"
#include "sensesp/transforms/moving_average.h"
#include "sensesp_app_builder.h"

#define SERIAL_DEBUG_DISABLED = true

Expand Down Expand Up @@ -37,12 +37,8 @@ void setup() {
// https://signalk.org/specification/1.4.0/doc/vesselsBranch.html#vesselsregexptanks
input->connect_to(avg)->connect_to(
new SKOutputFloat("tanks.fuel.0.currentLevel"));

sensesp_app->start();
}

// The loop function is called in an endless loop during program execution.
// It simply calls `app.tick()` which will then execute all reactions as needed.
void loop() {
app.tick();
}
void loop() { app.tick(); }
5 changes: 2 additions & 3 deletions examples/hysteresis.cpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@

#include "sensesp/transforms/hysteresis.h"

#include <math.h>

#include "sensesp/sensors/analog_input.h"
#include "sensesp/signalk/signalk_output.h"
#include "sensesp/transforms/hysteresis.h"
#include "sensesp_app_builder.h"

using namespace sensesp;
Expand Down Expand Up @@ -44,8 +45,6 @@ void setup() {
->connect_to(new Hysteresis<float, bool>(0.3, 0.5, false, true,
"/transforms/hysteresis"))
->connect_to(new SKOutputBool(sk_path));

sensesp_app->start();
}

// The loop function is called in an endless loop during program execution.
Expand Down
5 changes: 2 additions & 3 deletions examples/lambda_transform.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
#include "sensesp/transforms/lambda_transform.h"

#include <math.h>

#include "sensesp/sensors/analog_input.h"
#include "sensesp/signalk/signalk_output.h"
#include "sensesp/transforms/lambda_transform.h"
#include "sensesp_app_builder.h"

using namespace sensesp;
Expand Down Expand Up @@ -89,8 +90,6 @@ void setup() {

analog_input->connect_to(log_transform)
->connect_to(new SKOutputFloat(sk_path));

sensesp_app->start();
}

// The loop function is called in an endless loop during program execution.
Expand Down
2 changes: 0 additions & 2 deletions examples/manual_networking.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,6 @@ void setup() {
}));

digin->connect_to(new SKOutputBool("electrical.switches.0.state", "/digin/state"));

sensesp_app->start();
}

// The loop function is called in an endless loop during program execution.
Expand Down
3 changes: 0 additions & 3 deletions examples/milone_level_sensor/milone_level_sensor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,6 @@ void setup() {
"/freshWaterTank_starboard/samples"))
->connect_to(
new SKOutputFloat("tanks.freshwater.starboard.currentLevel"));

// Start the SensESP application running
sensesp_app->start();
}

// The loop function is called in an endless loop during program execution.
Expand Down
5 changes: 1 addition & 4 deletions examples/minimal_app.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@ void setup() {
// manually create Networking and HTTPServer objects to enable
// the HTTP configuration interface

auto* networking = new Networking(
"/system/net", "", "", SensESPBaseApp::get_hostname(), "thisisfine");
auto* networking = new Networking("/system/net", "", "");
auto* http_server = new HTTPServer();

auto* digin1 = new DigitalInputCounter(input_pin1, INPUT, RISING, read_delay);
Expand Down Expand Up @@ -67,8 +66,6 @@ void setup() {
pinMode(output_pin2, OUTPUT);
app.onRepeat(100,
[]() { digitalWrite(output_pin2, !digitalRead(output_pin2)); });

sensesp_app->start();
}

// The loop function is called in an endless loop during program execution.
Expand Down
4 changes: 1 addition & 3 deletions examples/raw_json.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ void setup() {
// take some boolean input and convert it into a simple serialized JSON
// document
auto jsonify = new LambdaTransform<bool, String>([](bool input) -> String {
DynamicJsonDocument doc(1024);
JsonDocument doc;
doc["output_1"] = input;
String output;
serializeJson(doc, output);
Expand All @@ -45,8 +45,6 @@ void setup() {

const char *sk_path = "environment.json.pin15";
jsonify->connect_to(new SKOutputRawJson(sk_path, ""));

sensesp_app->start();
}

void loop() { app.tick(); }
3 changes: 0 additions & 3 deletions examples/relay_control.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,6 @@ void setup() {
auto* listener = new FloatSKListener(sk_path);
listener->connect_to(new FloatThreshold(0.0f, 100.0f, true, config_path))
->connect_to(new DigitalOutput(5));

// Start the SensESP application running
sensesp_app->start();
}

// The loop function is called in an endless loop during program execution.
Expand Down
3 changes: 0 additions & 3 deletions examples/repeat_sensor_analog_input.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,6 @@ void setup() {
// consumer that displays it, is "Indoor light".
analog_input->connect_to(
new SKOutputFloat(sk_path, "", new SKMetadata("ratio", "Indoor light")));

// Start the SensESP application running
sensesp_app->start();
}

// The loop function is called in an endless loop during program execution.
Expand Down
5 changes: 0 additions & 5 deletions examples/rpm_counter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,6 @@ void setup() {
->connect_to(new SKOutputFloat(
sk_path, config_path_skpath)); // connect the output of Frequency()
// to a Signal K Output as a number

// Start the SensESP application running. Because of everything that's been
// set up above, it constantly monitors the interrupt pin, and every
// read_delay ms, it sends the calculated frequency to Signal K.
sensesp_app->start();
}

// The loop function is called in an endless loop during program execution.
Expand Down
3 changes: 0 additions & 3 deletions examples/smart_switch/remote_switch_example.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,6 @@ void setup() {
// confirms it has made the change in state.
auto* sk_listener = new SKValueListener<bool>(sk_path);
sk_listener->connect_to(controller);

// Start the SensESP application running
sensesp_app->start();
}

// The loop function is called in an endless loop during program execution.
Expand Down
3 changes: 0 additions & 3 deletions examples/smart_switch/smart_switch_example.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,6 @@ void setup() {
// lets the server know the switch is still alive.
load_switch->connect_to(new RepeatReport<bool>(10000, config_path_repeat))
->connect_to(new SKOutputBool(sk_path, config_path_sk_output));

// Start the SensESP application running
sensesp_app->start();
}

// The loop function is called in an endless loop during program execution.
Expand Down
20 changes: 10 additions & 10 deletions examples/temperature_sender.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,30 +143,30 @@ void setup() {
const float R1 = 51.0;

// An AnalogInput gets the value from the microcontroller's AnalogIn pin,
// which is a value from 0 to 1023 and then scales it to the max pin voltage (max_analog_in_voltage), giving the pin voltage.
// which is a value from 0 to 1023 and then scales it to the max pin voltage
// (max_analog_in_voltage), giving the pin voltage.
const float max_analog_in_voltage = 3.3;
// ESP32 has many pins that can be used for AnalogIn, and they're
// expressed here as the XX in GPIOXX.
auto* analog_input = new AnalogInput(36, 1000, "/12V_alternator/temp/analog_in/", max_analog_in_voltage);
auto* analog_input = new AnalogInput(
36, 1000, "/12V_alternator/temp/analog_in/", max_analog_in_voltage);

/* Translating the number returned by AnalogInput into a temperature, and
sending it to Signal K, requires several transforms. Wire them up in
sequence:
/* Translating the number returned by AnalogInput into a temperature,
and sending it to Signal K, requires several transforms. Wire them
up in sequence:
- convert voltage into ohms with VoltageDividerR2()
- find the Kelvin value for the given ohms value with
TemperatureInterpreter()
- use Linear() in case you want to calibrate the output at runtime
- send calibrated Kelvin value to Signal K with SKOutputNumber()
*/
->connect_to(new VoltageDividerR2(R1, volt_div_v_in, "/12V_alternator/temp/sender"))
analog_input
->connect_to(new VoltageDividerR2(R1, volt_div_v_in,
"/12V_alternator/temp/sender"))
->connect_to(new TemperatureInterpreter("/12V_alternator/temp/curve"))
->connect_to(new Linear(1.0, 0.0, "/12V_alternator/temp/calibrate"))
->connect_to(
new SKOutputFloat(sk_path, "/12V_alternator/temp/sk", metadata));

// Start the SensESP application running, which simply activates everything
// that's been set up above
sensesp_app->start();
}

// The loop function is called in an endless loop during program execution.
Expand Down
3 changes: 0 additions & 3 deletions examples/time_counter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,6 @@ void setup() {
engine_hours->connect_to(
new SKOutput<float>("propulsion.main.runTime", "",
new SKMetadata("s", "Main Engine running time")));

// Start the SensESP application running
sensesp_app->start();
}

void loop() { app.tick(); }
Loading
Loading