-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Build] Add short compressed build description (#3262)
See #3262 Outputs `Tffff:7:P17:2400:22:(3):10:` Equivalent to: ``` "CONTROLLER_SET_ALL", "NOTIFIER_SET_NONE", "PLUGIN_SET_ONLY_SWITCH", "USES_P001", # Switch "USES_P002", # ADC "USES_P004", # Dallas DS18b20 "USES_P100", # Pulse Counter - DS2423 "USES_C016", # Cache Controller "USES_C018", # TTN/RN2483 "USES_C015", # TTN/RN2483 ``` Still missing Notifier, CPU, flash size. [Build] Fix bit order in build description Fix build issues after merge
- Loading branch information
Showing
5 changed files
with
124 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
#include "ESPEasy_Build_Description.h" | ||
|
||
|
||
#include "../Globals/CPlugins.h" | ||
#include "../Globals/NPlugins.h" | ||
#include "../Globals/Plugins.h" | ||
|
||
xPluginEnumerator::xPluginEnumerator() {} | ||
|
||
void xPluginEnumerator::setSize(unsigned int maxID) { | ||
const unsigned int wordSize = (maxID / 16) + 1; | ||
|
||
if (_bitmap.size() < wordSize) { | ||
_bitmap.resize(wordSize, 0); | ||
} | ||
} | ||
|
||
void xPluginEnumerator::add(unsigned int ID) { | ||
setSize(ID); | ||
unsigned int wordIndex = ID / 16; | ||
unsigned int bitIndex = 15 - (ID % 16); | ||
|
||
bitSet(_bitmap[wordIndex], bitIndex); | ||
} | ||
|
||
String xPluginEnumerator::getString(char separator) const { | ||
String result; | ||
|
||
result.reserve(_bitmap.size() * 5); // 4 HEX characters per 16 bit value + separator | ||
size_t zeroCount = 0; | ||
|
||
for (size_t i = 0; i < _bitmap.size(); ++i) { | ||
if (_bitmap[i] == 0) { | ||
++zeroCount; | ||
} else if (zeroCount > 0) { | ||
result += '('; | ||
result += zeroCount; | ||
result += ')'; | ||
result += separator; | ||
zeroCount = 0; | ||
} | ||
|
||
if (zeroCount == 0) { | ||
result += String(_bitmap[i], HEX); | ||
result += separator; | ||
} | ||
} | ||
return result; | ||
} | ||
|
||
String CreateBuildDescription(char separator) { | ||
String result; | ||
|
||
{ | ||
result += 'T'; | ||
xPluginEnumerator cplugins; | ||
const unsigned int size = ProtocolIndex_to_CPlugin_id.size(); | ||
cplugins.setSize(size); | ||
|
||
for (size_t i = 0; i < size; ++i) { | ||
cplugins.add(ProtocolIndex_to_CPlugin_id[i]); | ||
} | ||
result += cplugins.getString(separator); | ||
} | ||
{ | ||
result += 'P'; | ||
xPluginEnumerator plugins; | ||
const unsigned int size = DeviceIndex_to_Plugin_id.size(); | ||
plugins.setSize(size); | ||
|
||
for (size_t i = 0; i < size; ++i) { | ||
plugins.add(DeviceIndex_to_Plugin_id[i]); | ||
} | ||
result += plugins.getString(separator); | ||
} | ||
{ | ||
// FIXME TD-er: Right now we don't have a notifierindex to ID vector | ||
|
||
/* | ||
result += 'N'; | ||
xPluginEnumerator plugins; | ||
const unsigned int size = DeviceIndex_to_Plugin_id.size(); | ||
plugins.setSize(size); | ||
for (size_t i = 0; i < size; ++i) { | ||
plugins.add(DeviceIndex_to_Plugin_id[i]); | ||
} | ||
result += plugins.getString(separator); | ||
*/ | ||
} | ||
return result; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#ifndef HELPERS_ESPEASY_BUILD_DESCRIPTION_H | ||
#define HELPERS_ESPEASY_BUILD_DESCRIPTION_H | ||
|
||
#include <Arduino.h> | ||
#include <vector> | ||
|
||
struct xPluginEnumerator { | ||
public: | ||
|
||
xPluginEnumerator(); | ||
|
||
void setSize(unsigned int maxID); | ||
|
||
void add(unsigned int ID); | ||
|
||
String getString(char separator) const; | ||
|
||
private: | ||
|
||
std::vector<uint16_t>_bitmap; | ||
}; | ||
|
||
String CreateBuildDescription(char separator); | ||
|
||
|
||
#endif // HELPERS_ESPEASY_BUILD_DESCRIPTION_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters