mirror of
https://github.com/meshtastic/firmware.git
synced 2025-06-22 13:04:53 +00:00
[modules][serial] fix simple module ability to send
This commit is contained in:
parent
af9d4328eb
commit
4de557b4db
@ -196,6 +196,17 @@ Channel &Channels::getByIndex(ChannelIndex chIndex)
|
|||||||
return *ch;
|
return *ch;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Channel &Channels::getByName(const char* chName)
|
||||||
|
{
|
||||||
|
for (ChannelIndex i = 0; i < getNumChannels(); i++) {
|
||||||
|
if (strcasecmp(channelFile.channels[i].settings.name, chName) == 0) {
|
||||||
|
return channelFile.channels[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return getByIndex(getPrimaryIndex());
|
||||||
|
}
|
||||||
|
|
||||||
void Channels::setChannel(const Channel &c)
|
void Channels::setChannel(const Channel &c)
|
||||||
{
|
{
|
||||||
Channel &old = getByIndex(c.index);
|
Channel &old = getByIndex(c.index);
|
||||||
|
@ -40,6 +40,9 @@ class Channels
|
|||||||
/** Return the Channel for a specified index */
|
/** Return the Channel for a specified index */
|
||||||
Channel &getByIndex(ChannelIndex chIndex);
|
Channel &getByIndex(ChannelIndex chIndex);
|
||||||
|
|
||||||
|
/** Return the Channel for a specified name, return primary if not found */
|
||||||
|
Channel &getByName(const char* chName);
|
||||||
|
|
||||||
/** Using the index inside the channel, update the specified channel's settings and role. If this channel is being promoted
|
/** Using the index inside the channel, update the specified channel's settings and role. If this channel is being promoted
|
||||||
* to be primary, force all other channels to be secondary.
|
* to be primary, force all other channels to be secondary.
|
||||||
*/
|
*/
|
||||||
|
@ -221,8 +221,12 @@ MeshPacket *SerialModuleRadio::allocReply()
|
|||||||
|
|
||||||
void SerialModuleRadio::sendPayload(NodeNum dest, bool wantReplies)
|
void SerialModuleRadio::sendPayload(NodeNum dest, bool wantReplies)
|
||||||
{
|
{
|
||||||
|
Channel *ch = (boundChannel != NULL) ? &channels.getByName(boundChannel) : NULL;
|
||||||
MeshPacket *p = allocReply();
|
MeshPacket *p = allocReply();
|
||||||
p->to = dest;
|
p->to = dest;
|
||||||
|
if (ch != NULL) {
|
||||||
|
p->channel = ch->index;
|
||||||
|
}
|
||||||
p->decoded.want_response = wantReplies;
|
p->decoded.want_response = wantReplies;
|
||||||
|
|
||||||
p->want_ack = ACK;
|
p->want_ack = ACK;
|
||||||
|
Loading…
Reference in New Issue
Block a user