diff --git a/interface/src/project/DashboardData.tsx b/interface/src/project/DashboardData.tsx index 4023227fc..ba589b513 100644 --- a/interface/src/project/DashboardData.tsx +++ b/interface/src/project/DashboardData.tsx @@ -37,7 +37,7 @@ import CancelIcon from '@mui/icons-material/Cancel'; import SendIcon from '@mui/icons-material/TrendingFlat'; import SaveIcon from '@mui/icons-material/Save'; import RemoveIcon from '@mui/icons-material/RemoveCircleOutline'; -import FavoriteIcon from '@mui/icons-material/Favorite'; +import FavoriteBorderIcon from '@mui/icons-material/FavoriteBorder'; import PlayArrowIcon from '@mui/icons-material/PlayArrow'; import DeviceIcon from './DeviceIcon'; @@ -500,7 +500,7 @@ const DashboardData: FC = () => { return ( {name}  - + ); } @@ -509,7 +509,7 @@ const DashboardData: FC = () => { return ( {name}  - + ); } diff --git a/interface/src/project/SettingsCustomization.tsx b/interface/src/project/SettingsCustomization.tsx index baf3a7480..b6e3f77a5 100644 --- a/interface/src/project/SettingsCustomization.tsx +++ b/interface/src/project/SettingsCustomization.tsx @@ -213,7 +213,7 @@ const SettingsCustomization: FC = () => { {deviceEntities.map((de) => ( - + = 0; fav--) { for (auto & dv : devicevalues_) { - bool state = (!i && dv.has_state(DeviceValueState::DV_FAVORITE)) || (i && !dv.has_state(DeviceValueState::DV_FAVORITE)); - if (state && (!dv.has_state(DeviceValueState::DV_WEB_EXCLUDE) && dv.full_name && (dv.hasValue() || (dv.type == DeviceValueType::CMD)))) { + // check conditions: + // 1. full_name cannot be empty + // 2. it must have a valid value, if it is not a command like 'reset' + // 3. show favorites first + bool show = (fav && dv.has_state(DeviceValueState::DV_FAVORITE)) || (!fav && !dv.has_state(DeviceValueState::DV_FAVORITE)); + if (show && !dv.has_state(DeviceValueState::DV_WEB_EXCLUDE) && dv.full_name && (dv.hasValue() || (dv.type == DeviceValueType::CMD))) { JsonObject obj = data.createNestedObject(); // create the object, we know there is a value uint8_t fahrenheit = 0; @@ -842,7 +843,6 @@ void EMSdevice::generate_values_web_all(JsonArray & output) { obj["m"] = dv.state >> 4; // send back the mask state. We're only interested in the high nibble obj["w"] = dv.has_cmd; // if writable - obj["i"] = dv.id; // add the unique ID } } diff --git a/src/emsdevice.h b/src/emsdevice.h index 9f292169a..99e780bd2 100644 --- a/src/emsdevice.h +++ b/src/emsdevice.h @@ -383,11 +383,6 @@ class EMSdevice { // device values std::vector devicevalues_; - - uint8_t dv_index_ = 0; // unique counter for each added device value - uint8_t get_next_dv_id() { - return (dv_index_++); - } }; } // namespace emsesp diff --git a/src/emsdevicevalue.h b/src/emsdevicevalue.h index 9571218aa..5b8c358ea 100644 --- a/src/emsdevicevalue.h +++ b/src/emsdevicevalue.h @@ -137,7 +137,6 @@ class DeviceValue { int16_t min; // min range uint16_t max; // max range uint8_t state; // DeviceValueState::* - uint8_t id; // internal unique counter DeviceValue(uint8_t device_type, uint8_t tag, @@ -152,8 +151,7 @@ class DeviceValue { bool has_cmd, int16_t min, uint16_t max, - uint8_t state, - uint8_t id) + uint8_t state) : device_type(device_type) , tag(tag) , value_p(value_p) @@ -167,8 +165,7 @@ class DeviceValue { , has_cmd(has_cmd) , min(min) , max(max) - , state(state) - , id(id) { + , state(state) { } bool hasValue();