auto-formatting

This commit is contained in:
proddy
2026-06-28 14:39:02 +02:00
parent 61d3ad023a
commit 7f308f4036
7 changed files with 33 additions and 34 deletions

View File

@@ -13,11 +13,7 @@ import VisibilityOutlinedIcon from '@mui/icons-material/VisibilityOutlined';
import type { SvgIconProps } from '@mui/material';
export type OptionType =
| 'deleted'
| 'readonly'
| 'web_exclude'
| 'api_mqtt_exclude'
| 'favorite';
'deleted' | 'readonly' | 'web_exclude' | 'api_mqtt_exclude' | 'favorite';
type IconPair = [
React.ComponentType<SvgIconProps>,

View File

@@ -207,12 +207,12 @@ class AnalogSensor {
uint32_t sensorreads_ = 0;
#ifndef EMSESP_STANDALONE
static void IRAM_ATTR freqIrq0();
static void IRAM_ATTR freqIrq1();
static void IRAM_ATTR freqIrq2();
static void IRAM_ATTR freqIrq0();
static void IRAM_ATTR freqIrq1();
static void IRAM_ATTR freqIrq2();
static volatile unsigned long edge[3]; // written from freqIrqN() ISRs, read from the main measure() loop (partly outside the critical section)
static volatile unsigned long edgecnt[3]; // written from freqIrqN() ISRs, read from the main measure() loop (partly outside the critical section)
unsigned long lastedge[3] = {0, 0, 0};
unsigned long lastedge[3] = {0, 0, 0};
#endif
};

View File

@@ -381,8 +381,8 @@ uint8_t Command::call(const uint8_t device_type, const char * command, const cha
// for the Commands device, calling a named command executes it (using its stored value)
// rather than returning its definition, so skip the value-info lookup and fall through
// to the registered command function. The list keywords above are still handled.
bool is_named_command = (device_type == EMSdevice::DeviceType::COMMAND) && strcmp(cmd, F_(info)) && strcmp(cmd, F_(values))
&& strcmp(cmd, F_(entities)) && strcmp(cmd, F_(metrics));
bool is_named_command = (device_type == EMSdevice::DeviceType::COMMAND) && strcmp(cmd, F_(info)) && strcmp(cmd, F_(values)) && strcmp(cmd, F_(entities))
&& strcmp(cmd, F_(metrics));
if (!is_named_command && EMSESP::get_device_value_info(output, cmd, id, device_type)) { // entity = cmd
LOG_DEBUG("Fetched device entity/attributes for %s/%s (id=%d)", dname, cmd, id);
return CommandRet::OK;

View File

@@ -59,7 +59,7 @@ using cmd_function_p = std::function<bool(const char * data, const int8_t id, Js
class Command {
public:
struct CmdFunction {
uint8_t device_type_; // DeviceType::
uint8_t device_type_; // DeviceType::
uint8_t device_id_;
uint8_t flags_; // mqtt flags for command subscriptions
bool has_json_output_; // true if the command writes JSON output; such commands bypass the readonly check
@@ -116,8 +116,11 @@ class Command {
static void
add(const uint8_t device_type, const char * cmd, const cmd_function_p cb, const char * const * description, uint8_t flags = CommandFlag::CMD_FLAG_DEFAULT);
// command that writes a JSON object as its output; bypasses the readonly check
static void
add_json(const uint8_t device_type, const char * cmd, const cmd_function_p cb, const char * const * description, uint8_t flags = CommandFlag::CMD_FLAG_DEFAULT);
static void add_json(const uint8_t device_type,
const char * cmd,
const cmd_function_p cb,
const char * const * description,
uint8_t flags = CommandFlag::CMD_FLAG_DEFAULT);
static void reserve(size_t num) {
cmdfunctions_.reserve(num);

View File

@@ -351,10 +351,10 @@ bool DeviceValue::get_min_max(int16_t & dv_set_min, uint32_t & dv_set_max) {
// extract custom min from custom_fullname
bool DeviceValue::get_custom_min(int16_t & val) {
const auto & cf = custom_fullname();
auto min_pos = cf.find('>');
bool has_min = (min_pos != std::string::npos);
uint8_t fahrenheit = !EMSESP::system_.fahrenheit() ? 0 : (uom == DeviceValueUOM::DEGREES) ? 2 : (uom == DeviceValueUOM::DEGREES_R) ? 1 : 0;
const auto & cf = custom_fullname();
auto min_pos = cf.find('>');
bool has_min = (min_pos != std::string::npos);
uint8_t fahrenheit = !EMSESP::system_.fahrenheit() ? 0 : (uom == DeviceValueUOM::DEGREES) ? 2 : (uom == DeviceValueUOM::DEGREES_R) ? 1 : 0;
if (has_min) {
int32_t v = Helpers::atoint(cf.substr(min_pos + 1).c_str());
if (fahrenheit) {
@@ -370,10 +370,10 @@ bool DeviceValue::get_custom_min(int16_t & val) {
// extract custom max from custom_fullname
bool DeviceValue::get_custom_max(uint32_t & val) {
const auto & cf = custom_fullname();
auto max_pos = cf.find('<');
bool has_max = (max_pos != std::string::npos);
uint8_t fahrenheit = !EMSESP::system_.fahrenheit() ? 0 : (uom == DeviceValueUOM::DEGREES) ? 2 : (uom == DeviceValueUOM::DEGREES_R) ? 1 : 0;
const auto & cf = custom_fullname();
auto max_pos = cf.find('<');
bool has_max = (max_pos != std::string::npos);
uint8_t fahrenheit = !EMSESP::system_.fahrenheit() ? 0 : (uom == DeviceValueUOM::DEGREES) ? 2 : (uom == DeviceValueUOM::DEGREES_R) ? 1 : 0;
if (has_max) {
int32_t v = Helpers::atoint(cf.substr(max_pos + 1).c_str());
if (fahrenheit) {

View File

@@ -1884,16 +1884,16 @@ void EMSESP::loop() {
if (EMSESP::system_.systemStatus() != SYSTEM_STATUS::SYSTEM_STATUS_PENDING_UPLOAD
&& EMSESP::system_.systemStatus() != SYSTEM_STATUS::SYSTEM_STATUS_UPLOADING) {
// loop through the services
webStatusService.loop(); // periodic refresh of cached versions.json
rxservice_.loop(); // process any incoming Rx telegrams
shower_.loop(); // check for shower on/off
temperaturesensor_.loop(); // read sensor temperatures
analogsensor_.loop(); // read analog sensor values
publish_all_loop(); // with HA messages in parts to avoid flooding the MQTT queue
mqtt_.loop(); // sends out anything in the MQTT queue
webModulesService.loop(); // loop through the external library modules
webSchedulerService.loop(); // scheduler timing logic; command execution is offloaded to WebCommandService's worker task
scheduled_fetch_values(); // force a query on the EMS devices to fetch latest data at a set interval (1 min)
webStatusService.loop(); // periodic refresh of cached versions.json
rxservice_.loop(); // process any incoming Rx telegrams
shower_.loop(); // check for shower on/off
temperaturesensor_.loop(); // read sensor temperatures
analogsensor_.loop(); // read analog sensor values
publish_all_loop(); // with HA messages in parts to avoid flooding the MQTT queue
mqtt_.loop(); // sends out anything in the MQTT queue
webModulesService.loop(); // loop through the external library modules
webSchedulerService.loop(); // scheduler timing logic; command execution is offloaded to WebCommandService's worker task
scheduled_fetch_values(); // force a query on the EMS devices to fetch latest data at a set interval (1 min)
compact_entities_if_stable(); // reclaim over-reserved entity vector capacity once device discovery settles
}
// check for GPIO Errors - this is called once when booting

View File

@@ -83,8 +83,8 @@ class WebCommandService : public StatefulService<WebCommands> {
bool queueCommand(const char * name, const char * value = nullptr);
bool dispatchCommand(const char * name, const char * value = nullptr);
static bool isUrlCommand(const std::string & command); // true if the command definition is a HTTP/URL command
static bool valueContainsUrl(const std::string & value); // true if a value embeds a {"url":...} compute() will fetch
static bool isUrlCommand(const std::string & command); // true if the command definition is a HTTP/URL command
static bool valueContainsUrl(const std::string & value); // true if a value embeds a {"url":...} compute() will fetch
const CommandItem * find(const char * name);