serialplugin - ability to configure ACK

1.2-legacy
Jm 2021-01-13 23:21:55 -08:00
rodzic b1181deb58
commit f68a31ab28
1 zmienionych plików z 13 dodań i 4 usunięć

Wyświetl plik

@ -32,10 +32,16 @@
7) (Optional) Set SERIALPLUGIN_ECHO to 1 and any message you send out will be echoed back 7) (Optional) Set SERIALPLUGIN_ECHO to 1 and any message you send out will be echoed back
to your device. to your device.
TODO: TODO (in this order):
* Once protobufs regenerated with the new port, update SerialPlugin.h * Once protobufs regenerated with the new port, update SerialPlugin.h
* Implement an interface to enable / disable ack
* Ensure this works on a tbeam * Ensure this works on a tbeam
* Define a verbose RX mode to report on mesh and packet infomration.
- This won't happen any time soon.
KNOWN PROBLEMS
* Until the plugin is initilized by the startup sequence, the TX pin is in a floating
state. Device connected to that pin may see this as "noise".
*/ */
@ -43,10 +49,11 @@
#define TXD2 17 #define TXD2 17
#define SERIALPLUGIN_RX_BUFFER 128 #define SERIALPLUGIN_RX_BUFFER 128
#define SERIALPLUGIN_STRING_MAX Constants_DATA_PAYLOAD_LEN #define SERIALPLUGIN_STRING_MAX Constants_DATA_PAYLOAD_LEN
#define SERIALPLUGIN_TIMEOUT 100 #define SERIALPLUGIN_TIMEOUT 250
#define SERIALPLUGIN_BAUD 38400 #define SERIALPLUGIN_BAUD 38400
#define SERIALPLUGIN_ENABLED 0 #define SERIALPLUGIN_ENABLED 1
#define SERIALPLUGIN_ECHO 0 #define SERIALPLUGIN_ECHO 0
#define SERIALPLUGIN_ACK 0
SerialPlugin *serialPlugin; SerialPlugin *serialPlugin;
SerialPluginRadio *serialPluginRadio; SerialPluginRadio *serialPluginRadio;
@ -108,6 +115,8 @@ void SerialPluginRadio::sendPayload(NodeNum dest, bool wantReplies)
p->to = dest; p->to = dest;
p->decoded.want_response = wantReplies; p->decoded.want_response = wantReplies;
p->want_ack = SERIALPLUGIN_ACK;
p->decoded.data.payload.size = strlen(serialStringChar); // You must specify how many bytes are in the reply p->decoded.data.payload.size = strlen(serialStringChar); // You must specify how many bytes are in the reply
memcpy(p->decoded.data.payload.bytes, serialStringChar, p->decoded.data.payload.size); memcpy(p->decoded.data.payload.bytes, serialStringChar, p->decoded.data.payload.size);