ESP-LiveControl  1.99.1
HTTP server, AJAX API backend and Vue.js web application implementing self-contained, zero-install WiFi remote control of hardware modules attached to the Espressif ESP32 SoC
Public Member Functions | Public Attributes | Static Public Attributes | List of all members
AppController Class Reference

Application main controller for PS-PWM generator hardware. More...

#include <app_controller.hpp>

Collaboration diagram for AppController:
Collaboration graph
[legend]

Public Member Functions

 AppController (AppState &state, APIServer *api_server)
 
void begin ()
 Begin operation. This also starts the timer callbacks etc. This will fail if networking etc. is not set up correctly!
 
void set_setpoint_throttling_enabled (bool new_val)
 
void set_frequency_min_khz (float n)
 
void set_frequency_max_khz (float n)
 
void set_frequency_khz (float n)
 
void set_frequency_changerate_khz_sec (float n)
 Set rate of change of frequency in kHz per second.
 
void _set_frequency_raw (float n)
 
void set_duty_min_percent (float n)
 
void set_duty_max_percent (float n)
 
void set_duty_percent (float n)
 
void set_duty_changerate_percent_sec (float n)
 Set rate of change of duty cycle in percent per second.
 
void _set_duty_raw (float n)
 
void set_lag_dt_ns (float n)
 
void set_lead_dt_ns (float n)
 
void set_power_pwm_active (bool new_val)
 Activate PWM power output if arg is true.
 
void set_oneshot_len (float n)
 Set power output oneshot pulse timer pulse length in seconds.
 
void trigger_oneshot ()
 Trigger the power output oneshot pulse.
 
void clear_shutdown ()
 
void set_current_limit (float n)
 
void set_temp_1_limit (float n)
 Set overtemperature shutdown limits.
 
void set_temp_2_limit (float n)
 
void set_relay_ref_active (bool new_val)
 
void set_relay_dut_active (bool new_val)
 
void set_fan_override (bool new_val)
 When set to true, override automatic and set fan permanently on.
 
void save_settings ()
 Save all runtime configurable settings to SPI flash. The settings are a subset of all values in struct AppState. More...
 
void restore_settings ()
 Read state back from SPI flash file and initialize the hardware with these settings. More...
 

Public Attributes

AppStatestate
 
AuxHwDrv aux_hw_drv
 
APIServerapi_server
 

Static Public Attributes

static constexpr auto constants = AppConstants{}
 Configuration and initial values for the application state.
 

Detailed Description

Application main controller for PS-PWM generator hardware.

This features the main control functions for PWM frequency, duty cycle etc.

Also, periodic state feedback for all hardware functions is sent to the HTTP remote interface using Server-Sent Events from a FreeRTOS timer task.

Some auxiliary functions like GPIO and temperature readouts is outsourced to the AuxHwDrv class, see aux_hw_drv.hpp.

In more detail: This configures all parameters of a four-channel Phase-Shift PWM waveform plus auxiliary hardware setpoints, relay outputs etc.

Member Function Documentation

◆ restore_settings()

void AppController::restore_settings ( )

Read state back from SPI flash file and initialize the hardware with these settings.

This is called on boot.

◆ save_settings()

void AppController::save_settings ( )

Save all runtime configurable settings to SPI flash. The settings are a subset of all values in struct AppState.

The stored settings are restored on reboot.

Here is the call graph for this function:

The documentation for this class was generated from the following files: