5#define LED_PIN LED_BUILTIN
9#define ENABLE_LED false
57 static std::shared_ptr<SensESPApp>
get() {
61 return std::static_pointer_cast<SensESPApp>(
instance_);
65 bool outside_users =
instance_.use_count() > 2;
69 "SensESPApp instance has active references and won't be properly "
75 return !outside_users;
127 std::shared_ptr<SystemStatusLed>& system_status_led) {
132 this->
http_server_->set_auth_credentials(username, password,
true);
169 bool captive_portal_enabled =
networking_->is_captive_portal_enabled();
173 this->
http_server_->set_captive_portal(captive_portal_enabled);
188 this->
ws_client_ = std::make_shared<SKWSClient>(
195 this->
networking_->get_wifi_state_producer()->connect_to(
210 this->
ws_client_->get_delta_tx_count_producer().connect_to(
234 int event_loop_queue_size =
event_loop_->getEventQueueSize();
235 int event_loop_timed_queue_size =
event_loop_->getTimedEventQueueSize();
236 int event_loop_untimed_queue_size =
240 uint64_t current_tick_count =
event_loop_->getTickCount();
244 uint64_t current_event_count =
event_loop_->getEventCount();
245 uint64_t current_timed_event_count =
event_loop_->getTimedEventCount();
246 uint64_t current_untimed_event_count =
event_loop_->getUntimedEventCount();
252 static uint64_t last_tick_count = 0;
253 static uint64_t last_event_count = 0;
254 static uint64_t last_timed_event_count = 0;
255 static uint64_t last_untimed_event_count = 0;
256 static uint64_t last_millis = 0;
257 uint64_t current_millis = millis();
258 float interval_seconds = (current_millis - last_millis) / 1000.0;
260 uint64_t ticks_diff = current_tick_count - last_tick_count;
261 uint64_t events_diff = current_event_count - last_event_count;
262 uint64_t timed_events_diff =
263 current_timed_event_count - last_timed_event_count;
264 uint64_t untimed_events_diff =
265 current_untimed_event_count - last_untimed_event_count;
277 int(timed_events_diff / interval_seconds));
279 int(untimed_events_diff / interval_seconds));
282 last_tick_count = current_tick_count;
283 last_event_count = current_event_count;
284 last_timed_event_count = current_timed_event_count;
285 last_untimed_event_count = current_untimed_event_count;
286 last_millis = current_millis;
292 ws_client_->get_delta_tx_count_producer().connect_to(
294 ws_client_->get_delta_rx_count_producer().connect_to(
311 std::make_shared<SystemStatusController>();
327 "MAC Address", WiFi.macAddress(),
"Network", 1300};
334 "",
"Signal K", 1600};
338 "",
"Signal K", 1800};
345 "Event Loop queue size", 0,
"Event Loop Queues", 2100};
347 "Event Loop timed queue size", 0,
"Event Loop Queues", 2200};
349 "Event Loop untimed queue size", 0,
"Event Loop Queues", 2300};
351 "Event Loop interrupt queue size", 0,
"Event Loop Queues", 2400};
354 "Total ticks processed", 0,
"Event Loop Lifetime", 2500};
356 "Event Loop Lifetime", 2600};
358 "Timed events processed", 0,
"Event Loop Lifetime", 2700};
360 "Untimed events processed", 0,
"Event Loop Lifetime", 2800};
362 "Ticks per second", 0,
"Event Loop Performance", 2900};
364 "Events per second", 0,
"Event Loop Performance", 3000};
366 "Timed events per second", 0,
"Event Loop Performance", 3100};
368 "Untimed events per second", 0,
"Event Loop Performance", 3200};
373 "Build date", __DATE__
" " __TIME__,
"Software", 3400};
void set(const T &value) override
A class for quickly configuring a SensESP application object before wiring up your sensors.
StatusPageItem< int > event_loop_interrupt_queue_ui_output_
const SensESPApp * set_sk_server_port(uint16_t sk_server_port)
StatusPageItem< String > sensesp_version_ui_output_
static std::shared_ptr< SensESPApp > get()
Get the singleton instance of the SensESPApp.
SensESPApp()
SensESPApp constructor.
void connect_status_page_items()
std::shared_ptr< SystemStatusLed > system_status_led_
void operator=(const SensESPApp &)=delete
std::shared_ptr< SKDeltaQueue > sk_delta_queue_
const SensESPApp * set_hostname(String hostname)
StatusPageItem< uint64_t > timed_event_count_ui_output_
std::shared_ptr< HTTPServer > http_server_
StatusPageItem< String > wifi_ssid_ui_output_
const SensESPApp * set_sk_server_address(String sk_server_address)
StatusPageItem< float > ticks_per_second_ui_output_
StatusPageItem< int8_t > wifi_rssi_ui_output_
virtual bool destroy() override
Destroy the SensESPBaseApp instance.
void setup()
Perform initialization of SensESPApp once builder configuration is done.
std::shared_ptr< ValueProducer< String > > ip_address_sensor_
String sk_server_address_
StatusPageItem< uint64_t > untimed_event_count_ui_output_
std::shared_ptr< ValueProducer< float > > uptime_sensor_
StatusPageItem< String > hostname_ui_output_
const SensESPApp * set_wifi_password(String wifi_password)
StatusPageItem< uint16_t > sk_server_port_ui_output_
StatusPageItem< String > sk_server_address_ui_output_
StatusPageItem< int > event_loop_timed_queue_ui_output_
std::shared_ptr< ValueProducer< uint32_t > > free_mem_sensor_
StatusPageItem< String > mac_address_ui_output_
std::shared_ptr< SKWSClient > get_ws_client()
const char * ota_password_
String wifi_client_password_
StatusPageItem< uint64_t > total_tick_count_ui_output_
StatusPageItem< int > uptime_ui_output_
std::shared_ptr< ValueProducer< int > > wifi_signal_sensor_
StatusPageItem< int > delta_rx_count_ui_output_
StatusPageItem< int > event_loop_untimed_queue_ui_output_
StatusPageItem< int > free_memory_ui_output_
StatusPageItem< float > timed_events_per_second_ui_output_
StatusPageItem< int > event_loop_queue_size_ui_output_
const SensESPApp * enable_ota(const char *password)
const SensESPApp * set_ap_password(const String &password)
const SensESPApp * set_admin_user(const char *username, const char *password)
std::shared_ptr< Networking > & get_networking()
StatusPageItem< uint64_t > event_count_ui_output_
std::shared_ptr< SystemStatusController > get_system_status_controller()
std::shared_ptr< SKWSClient > ws_client_
StatusPageItem< String > build_info_ui_output_
StatusPageItem< float > untimed_events_per_second_ui_output_
const SensESPApp * set_system_status_led(std::shared_ptr< SystemStatusLed > &system_status_led)
StatusPageItem< String > sk_server_connection_ui_output_
std::shared_ptr< SystemStatusController > system_status_controller_
std::shared_ptr< ButtonHandler > button_handler_
std::shared_ptr< MDNSDiscovery > mdns_discovery_
const SensESPApp * set_ap_ssid(const String &ssid)
const SensESPApp * set_ssid(String ssid)
StatusPageItem< float > events_per_second_ui_output_
std::shared_ptr< OTA > ota_
SensESPApp(SensESPApp &other)=delete
std::shared_ptr< SKDeltaQueue > get_sk_delta()
std::shared_ptr< Networking > networking_
StatusPageItem< int > delta_tx_count_ui_output_
std::shared_ptr< ValueProducer< float > > system_hz_sensor_
const SensESPApp * set_button_pin(int pin)
The base class for SensESP applications.
static String get_hostname()
Get the current hostname.
static std::shared_ptr< SensESPBaseApp > instance_
std::shared_ptr< reactesp::EventLoop > event_loop_
const SensESPBaseApp * set_hostname(String hostname)
std::shared_ptr< PersistingObservableValue< String > > hostname_
virtual void setup()
Perform initialization of SensESPBaseApp once builder configuration is done.
Item that renders its own value on the web UI status page.
void add_static_file_handlers(std::shared_ptr< HTTPServer > server)
Provide handlers for static web content.
void add_config_handlers(std::shared_ptr< HTTPServer > &server)
Handle HTTP requests to /config.
const char *const kSensESPVersion
std::shared_ptr< SensESPApp > sensesp_app
void add_app_http_command_handlers(std::shared_ptr< HTTPServer > &server)
void add_base_app_http_command_handlers(std::shared_ptr< HTTPServer > &server)
std::shared_ptr< ConfigItemT< T > > ConfigItem(std::shared_ptr< T >)
Register a ConfigItemT with the ConfigItemBase.
#define SENSESP_BUTTON_PIN