Skip to content

Commit 79a036f

Browse files
authored
Merge pull request #1131 from wel97459/dev-uint
Changed uint used in flags to uint8_t
2 parents 30ccc1f + 031fa1e commit 79a036f

File tree

5 files changed

+6
-6
lines changed

5 files changed

+6
-6
lines changed

examples/simple_repeater/MyMesh.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -545,7 +545,7 @@ void MyMesh::onPeerDataRecv(mesh::Packet *packet, uint8_t type, int sender_idx,
545545
} else if (type == PAYLOAD_TYPE_TXT_MSG && len > 5 && client->isAdmin()) { // a CLI command
546546
uint32_t sender_timestamp;
547547
memcpy(&sender_timestamp, data, 4); // timestamp (by sender's RTC clock - which could be wrong)
548-
uint flags = (data[4] >> 2); // message attempt number, and other flags
548+
uint8_t flags = (data[4] >> 2); // message attempt number, and other flags
549549

550550
if (!(flags == TXT_TYPE_PLAIN || flags == TXT_TYPE_CLI_DATA)) {
551551
MESH_DEBUG_PRINTLN("onPeerDataRecv: unsupported text type received: flags=%02x", (uint32_t)flags);

examples/simple_room_server/MyMesh.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,7 @@ void MyMesh::onPeerDataRecv(mesh::Packet *packet, uint8_t type, int sender_idx,
398398
if (type == PAYLOAD_TYPE_TXT_MSG && len > 5) { // a CLI command or new Post
399399
uint32_t sender_timestamp;
400400
memcpy(&sender_timestamp, data, 4); // timestamp (by sender's RTC clock - which could be wrong)
401-
uint flags = (data[4] >> 2); // message attempt number, and other flags
401+
uint8_t flags = (data[4] >> 2); // message attempt number, and other flags
402402

403403
if (!(flags == TXT_TYPE_PLAIN || flags == TXT_TYPE_CLI_DATA)) {
404404
MESH_DEBUG_PRINTLN("onPeerDataRecv: unsupported command flags received: flags=%02x", (uint32_t)flags);

examples/simple_sensor/SensorMesh.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -554,7 +554,7 @@ void SensorMesh::onPeerDataRecv(mesh::Packet* packet, uint8_t type, int sender_i
554554
} else if (type == PAYLOAD_TYPE_TXT_MSG && len > 5 && from->isAdmin()) { // a CLI command
555555
uint32_t sender_timestamp;
556556
memcpy(&sender_timestamp, data, 4); // timestamp (by sender's RTC clock - which could be wrong)
557-
uint flags = (data[4] >> 2); // message attempt number, and other flags
557+
uint8_t flags = (data[4] >> 2); // message attempt number, and other flags
558558

559559
if (sender_timestamp > from->last_timestamp) { // prevent replay attacks
560560
if (flags == TXT_TYPE_PLAIN) {
@@ -612,7 +612,7 @@ void SensorMesh::onPeerDataRecv(mesh::Packet* packet, uint8_t type, int sender_i
612612
}
613613
}
614614

615-
bool SensorMesh::handleIncomingMsg(ClientInfo& from, uint32_t timestamp, uint8_t* data, uint flags, size_t len) {
615+
bool SensorMesh::handleIncomingMsg(ClientInfo& from, uint32_t timestamp, uint8_t* data, uint8_t flags, size_t len) {
616616
MESH_DEBUG_PRINT("handleIncomingMsg: unhandled msg from ");
617617
#ifdef MESH_DEBUG
618618
mesh::Utils::printHex(Serial, from.id.pub_key, PUB_KEY_SIZE);

examples/simple_sensor/SensorMesh.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ class SensorMesh : public mesh::Mesh, public CommonCLICallbacks {
127127
bool onPeerPathRecv(mesh::Packet* packet, int sender_idx, const uint8_t* secret, uint8_t* path, uint8_t path_len, uint8_t extra_type, uint8_t* extra, uint8_t extra_len) override;
128128
void onControlDataRecv(mesh::Packet* packet) override;
129129
void onAckRecv(mesh::Packet* packet, uint32_t ack_crc) override;
130-
virtual bool handleIncomingMsg(ClientInfo& from, uint32_t timestamp, uint8_t* data, uint flags, size_t len);
130+
virtual bool handleIncomingMsg(ClientInfo& from, uint32_t timestamp, uint8_t* data, uint8_t flags, size_t len);
131131
void sendAckTo(const ClientInfo& dest, uint32_t ack_hash);
132132
private:
133133
FILESYSTEM* _fs;

src/helpers/BaseChatMesh.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ void BaseChatMesh::onPeerDataRecv(mesh::Packet* packet, uint8_t type, int sender
166166
if (type == PAYLOAD_TYPE_TXT_MSG && len > 5) {
167167
uint32_t timestamp;
168168
memcpy(&timestamp, data, 4); // timestamp (by sender's RTC clock - which could be wrong)
169-
uint flags = data[4] >> 2; // message attempt number, and other flags
169+
uint8_t flags = data[4] >> 2; // message attempt number, and other flags
170170

171171
// len can be > original length, but 'text' will be padded with zeroes
172172
data[len] = 0; // need to make a C string again, with null terminator

0 commit comments

Comments
 (0)