Updated to v0.3.1

Renamed mqtt_send to mqttSend to better follow my usual naming
convention. Made a few other small changes, including disabling
the debug macro by default. Just uncomment to add it again.

This is the version that will be used with the first release
of Part 3 of the SDK tutorials on hackaday.io.

Signed-off-by: A.M. Rowsell <amrowsell@frozenelectronics.ca>
This commit is contained in:
A.M. Rowsell 2019-02-27 02:28:00 -05:00
commit 8acff6e880
Signed by: amr
GPG key ID: 0B6E2D8375CF79A9
4 changed files with 32 additions and 21 deletions

9
mqtt.c
View file

@ -89,7 +89,10 @@ void ftoa(float n, char *res, int afterpoint)
}
void ICACHE_FLASH_ATTR data_sent_callback(void *arg) {
#ifdef DEBUG
os_printf("Data sent!\n");
#endif
return;
}
void ICACHE_FLASH_ATTR data_recv_callback(void *arg, char *pdata, unsigned short len) {
@ -266,14 +269,14 @@ uint8_t ICACHE_FLASH_ATTR *encodeLength(uint32_t trueLength) {
void ICACHE_FLASH_ATTR pingAlive(void *arg) {
mqtt_session_t *pSession = (mqtt_session_t *)arg;
mqtt_send(pSession, NULL, 0, MQTT_MSG_TYPE_PINGREQ);
mqttSend(pSession, NULL, 0, MQTT_MSG_TYPE_PINGREQ);
}
uint8_t ICACHE_FLASH_ATTR mqtt_send(mqtt_session_t *session, uint8_t *data, uint32_t len, mqtt_message_type msgType) {
uint8_t ICACHE_FLASH_ATTR mqttSend(mqtt_session_t *session, uint8_t *data, uint32_t len, mqtt_message_type msgType) {
if(session->validConnection == 1) {
os_timer_disarm(&MQTT_KeepAliveTimer); // disable timer if we are called
#ifdef DEBUG
os_printf("Entering mqtt_send!\n");
os_printf("Entering mqttSend!\n");
#endif
LOCAL mqtt_packet_t packet;
LOCAL mqtt_packet_t *pPacket = &packet;