Skip to content

Commit 86c2644

Browse files
committed
fixed tuanpmt#9 and resolve tuanpmt#10
1 parent 9e16ade commit 86c2644

File tree

6 files changed

+4
-3
lines changed

6 files changed

+4
-3
lines changed

esp8266/debug/0x00000.bin

-64 Bytes
Binary file not shown.

esp8266/debug/0x40000.bin

4 Bytes
Binary file not shown.

esp8266/release/0x00000.bin

-64 Bytes
Binary file not shown.

esp8266/release/0x40000.bin

4 Bytes
Binary file not shown.

espduino/mqtt.cpp

+3-2
Original file line numberDiff line numberDiff line change
@@ -99,13 +99,14 @@ void MQTT::subscribe(const char* topic)
9999
{
100100
subscribe(topic, 0);
101101
}
102-
void MQTT::publish(const char* topic, uint8_t *data, uint8_t len, uint8_t qos, uint8_t retain)
102+
void MQTT::publish(const char* topic, uint8_t *data, uint16_t len, uint8_t qos, uint8_t retain)
103103
{
104104
uint16_t crc;
105-
crc = esp->request(CMD_MQTT_PUBLISH, 0, 0, 5);
105+
crc = esp->request(CMD_MQTT_PUBLISH, 0, 0, 6);
106106
crc = esp->request(crc,(uint8_t*)&remote_instance, 4);
107107
crc = esp->request(crc,(uint8_t*)topic, strlen(topic));
108108
crc = esp->request(crc,(uint8_t*)data, len);
109+
crc = esp->request(crc,(uint8_t*)&len, 2);
109110
crc = esp->request(crc,(uint8_t*)&qos, 1);
110111
crc = esp->request(crc,(uint8_t*)&retain, 1);
111112
esp->request(crc);

espduino/mqtt.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class MQTT {
3333
void disconnect();
3434
void subscribe(const char* topic, uint8_t qos);
3535
void subscribe(const char* topic);
36-
void publish(const char* topic, uint8_t *data, uint8_t len, uint8_t qos, uint8_t retain);
36+
void publish(const char* topic, uint8_t *data, uint16_t len, uint8_t qos, uint8_t retain);
3737
void publish(const char* topic, char* data, uint8_t qos, uint8_t retain);
3838
void publish(const char* topic, char* data);
3939

0 commit comments

Comments
 (0)