56 static std::shared_ptr<SensESPApp>
get() {
60 return std::static_pointer_cast<SensESPApp>(
instance_);
137 std::function<std::shared_ptr<NetworkProvisioner>()> factory) {
182 std::shared_ptr<SystemStatusLed>& system_status_led) {
234 "provisioner_factory_ returned nullptr; falling back to "
235 "WiFiProvisioner so the rest of setup() has a valid object.");
239 auto wifi = std::make_shared<WiFiProvisioner>(
261 nsp->attach([nsp, wp]() { wp->emit(nsp->get()); });
270 bool captive_portal_enabled =
false;
271 IPAddress captive_portal_ap_ip;
279 this->
http_server_->set_captive_portal(captive_portal_enabled,
280 captive_portal_ap_ip);
307 this->
ws_client_ = std::make_shared<SKWSClient>(
331#elif defined(LED_BUILTIN)
338 this->
ws_client_->get_delta_tx_count_producer().connect_to(
383 int event_loop_queue_size =
event_loop_->getEventQueueSize();
384 int event_loop_timed_queue_size =
event_loop_->getTimedEventQueueSize();
385 int event_loop_untimed_queue_size =
389 uint64_t current_tick_count =
event_loop_->getTickCount();
393 uint64_t current_event_count =
event_loop_->getEventCount();
394 uint64_t current_timed_event_count =
event_loop_->getTimedEventCount();
395 uint64_t current_untimed_event_count =
402 static uint64_t last_tick_count = 0;
403 static uint64_t last_event_count = 0;
404 static uint64_t last_timed_event_count = 0;
405 static uint64_t last_untimed_event_count = 0;
406 static uint64_t last_millis = 0;
407 uint64_t current_millis = millis();
408 float interval_seconds = (current_millis - last_millis) / 1000.0;
410 uint64_t ticks_diff = current_tick_count - last_tick_count;
411 uint64_t events_diff = current_event_count - last_event_count;
412 uint64_t timed_events_diff =
413 current_timed_event_count - last_timed_event_count;
414 uint64_t untimed_events_diff =
415 current_untimed_event_count - last_untimed_event_count;
427 int(timed_events_diff / interval_seconds));
429 int(untimed_events_diff / interval_seconds));
432 last_tick_count = current_tick_count;
433 last_event_count = current_event_count;
434 last_timed_event_count = current_timed_event_count;
435 last_untimed_event_count = current_untimed_event_count;
436 last_millis = current_millis;
442 ws_client_->get_delta_tx_count_producer().connect_to(
444 ws_client_->get_delta_rx_count_producer().connect_to(
465 std::make_shared<SystemStatusController>();
485 "Min free memory before last reset (bytes)", 0,
"System", 1020};
498 "",
"Signal K", 1600};
502 "",
"Signal K", 1800};
509 "Event Loop queue size", 0,
"Event Loop Queues", 2100};
511 "Event Loop timed queue size", 0,
"Event Loop Queues", 2200};
513 "Event Loop untimed queue size", 0,
"Event Loop Queues", 2300};
515 "Event Loop interrupt queue size", 0,
"Event Loop Queues", 2400};
518 "Total ticks processed", 0,
"Event Loop Lifetime", 2500};
520 "Event Loop Lifetime", 2600};
522 "Timed events processed", 0,
"Event Loop Lifetime", 2700};
524 "Untimed events processed", 0,
"Event Loop Lifetime", 2800};
526 "Ticks per second", 0,
"Event Loop Performance", 2900};
528 "Events per second", 0,
"Event Loop Performance", 3000};
530 "Timed events per second", 0,
"Event Loop Performance", 3100};
532 "Untimed events per second", 0,
"Event Loop Performance", 3200};
537 "Build date", __DATE__
" " __TIME__,
"Software", 3400};
Captures ESP_LOGx output into a bounded RAM buffer for the web UI.
void install()
Install the chained vprintf hook. Call once, early in startup.
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()
void operator=(const SensESPApp &)=delete
String pending_admin_user_
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_
std::shared_ptr< NetworkProvisioner > & get_network_provisioner()
Active network provisioner (transport-agnostic).
StatusPageItem< String > wifi_ssid_ui_output_
std::shared_ptr< NetworkStateProducer > network_state_producer_
const SensESPApp * set_sk_server_address(String sk_server_address)
StatusPageItem< float > ticks_per_second_ui_output_
StatusPageItem< int8_t > wifi_rssi_ui_output_
std::shared_ptr< NetworkProvisioner > network_provisioner_
virtual bool destroy() override
Destroy the SensESPBaseApp instance.
std::shared_ptr< WiFiProvisioner > wifi_provisioner_
void setup()
Perform initialization of SensESPApp once builder configuration is done.
std::shared_ptr< ValueProducer< String > > ip_address_sensor_
StatusPageItem< int > min_free_before_reset_ui_output_
String sk_server_address_
StatusPageItem< uint64_t > untimed_event_count_ui_output_
std::shared_ptr< ValueProducer< float > > uptime_sensor_
StatusPageItem< int > min_free_memory_ui_output_
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_
std::shared_ptr< BaseSystemStatusLed > system_status_led_
std::shared_ptr< WiFiProvisioner > & get_wifi_provisioner()
Active WiFi provisioner, or nullptr if a non-WiFi transport is in use.
StatusPageItem< int > uptime_ui_output_
std::shared_ptr< ValueProducer< int > > wifi_signal_sensor_
std::function< std::shared_ptr< NetworkProvisioner >()> provisioner_factory_
StatusPageItem< int > delta_rx_count_ui_output_
StatusPageItem< int > event_loop_untimed_queue_ui_output_
StatusPageItem< int > free_memory_ui_output_
String pending_admin_pass_
StatusPageItem< float > timed_events_per_second_ui_output_
void set_network_provisioner_factory(std::function< std::shared_ptr< NetworkProvisioner >()> factory)
Install a custom factory that setup() will use to construct the NetworkProvisioner instead of the def...
StatusPageItem< int > event_loop_queue_size_ui_output_
std::shared_ptr< WiFiProvisioner > & get_networking()
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)
StatusPageItem< uint64_t > event_count_ui_output_
std::shared_ptr< SystemStatusController > get_system_status_controller()
std::shared_ptr< NetworkStateProducer > get_network_state_producer()
Unified producer that emits NetworkState transitions for any active interface (WiFi STA,...
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_
StatusPageItem< String > reset_reason_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()
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.
virtual bool destroy()
Destroy the SensESPBaseApp instance.
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
void begin_reset_info()
Reset-cause and pre-reset heap diagnostics for the status page.
const char * reset_reason_str()
std::shared_ptr< SensESPApp > sensesp_app
void add_tofu_reset_handler(std::shared_ptr< HTTPServer > &server)
void add_app_http_command_handlers(std::shared_ptr< HTTPServer > &server, std::shared_ptr< WiFiProvisioner > wifi_provisioner)
void add_base_app_http_command_handlers(std::shared_ptr< HTTPServer > &server)
uint32_t min_free_heap_before_reset()
std::shared_ptr< ConfigItemT< T > > ConfigItem(std::shared_ptr< T >)
Register a ConfigItemT with the ConfigItemBase.
void update_min_free_heap_watermark()