Add progmem support for String messages (#875)

added variant of MyMessage::set and sendSketchInfo that accept a
string that's stored in PROGMEM.

This avoids the need to (temporarily) store strings in memory to get
them into a message.
This commit is contained in:
Rainer Clasen
2017-06-21 23:41:48 +02:00
committed by Olivier
parent e5221689af
commit ff0953dd05
4 changed files with 40 additions and 1 deletions
+17 -1
View File
@@ -358,6 +358,22 @@ bool sendSketchInfo(const char *name, const char *version, const bool ack)
return result;
}
#if !defined(__linux__)
bool sendSketchInfo(const __FlashStringHelper *name, const __FlashStringHelper *version, const bool ack)
{
bool result = true;
if (name) {
result &= _sendRoute(build(_msgTmp, GATEWAY_ADDRESS, NODE_SENSOR_ID, C_INTERNAL, I_SKETCH_NAME,
ack).set(name));
}
if (version) {
result &= _sendRoute(build(_msgTmp, GATEWAY_ADDRESS, NODE_SENSOR_ID, C_INTERNAL, I_SKETCH_VERSION,
ack).set(version));
}
return result;
}
#endif
bool request(const uint8_t childSensorId, const uint8_t variableType, const uint8_t destination)
{
return _sendRoute(build(_msgTmp, destination, childSensorId, C_REQ, variableType).set(""));
@@ -700,4 +716,4 @@ void _checkNodeLock(void)
}
#if DOXYGEN
#endif
#endif