Size & speed optimisations

This commit is contained in:
Blaz Kristan
2024-07-11 21:22:58 +02:00
parent 1ec68c428a
commit cd1ede38a7
16 changed files with 72 additions and 70 deletions

View File

@@ -25,7 +25,7 @@ void alexaInit()
// names are identical as the preset names, switching off can be done by switching off any of them
if (alexaNumPresets) {
String name = "";
for (byte presetIndex = 1; presetIndex <= alexaNumPresets; presetIndex++)
for (unsigned presetIndex = 1; presetIndex <= alexaNumPresets; presetIndex++)
{
if (!getPresetName(presetIndex, name)) break; // no more presets
EspalexaDevice* dev = new EspalexaDevice(name.c_str(), onAlexaChange, EspalexaDeviceType::extendedcolor);
@@ -64,7 +64,7 @@ void onAlexaChange(EspalexaDevice* dev)
} else // switch-on behavior for preset devices
{
// turn off other preset devices
for (byte i = 1; i < espalexa.getDeviceCount(); i++)
for (unsigned i = 1; i < espalexa.getDeviceCount(); i++)
{
if (i == dev->getId()) continue;
espalexa.getDevice(i)->setValue(0); // turn off other presets
@@ -87,7 +87,7 @@ void onAlexaChange(EspalexaDevice* dev)
applyPreset(macroAlexaOff, CALL_MODE_ALEXA);
// below for loop stops Alexa from complaining if macroAlexaOff does not actually turn off
}
for (byte i = 0; i < espalexa.getDeviceCount(); i++)
for (unsigned i = 0; i < espalexa.getDeviceCount(); i++)
{
espalexa.getDevice(i)->setValue(0);
}