@@ -67,15 +67,15 @@ char S_50[] PROGMEM = "Sketch_version"; // Does not exist in MyMessage.h!
6767
6868
6969PROGMEM const char *sType [] = {
70- S_0, S_1, S_2, S_3, S_4, S_5, S_6, S_7, S_8, S_9, S_10,
70+ S_0, S_1, S_2, S_3, S_4, S_5, S_6, S_7, S_8, S_9, S_10,
7171 S_11, S_12, S_13, S_14, S_15, S_16, S_17, S_18, S_19, S_20,
72- S_21, S_22, S_23, S_24, S_25, S_26, S_27, S_28, S_29, S_30,
72+ S_21, S_22, S_23, S_24, S_25, S_26, S_27, S_28, S_29, S_30,
7373 S_31, S_32, S_33, S_34, S_35, S_36, S_37, S_38, S_39, S_40,
7474 S_41, S_42, S_43, S_44, S_45, S_46, S_47, S_48, S_49, S_50
7575};
7676
7777
78- MyMQTT::MyMQTT (uint8_t _cepin, uint8_t _cspin, uint8_t _rx, uint8_t _tx, uint8_t _er) :
78+ MyMQTT::MyMQTT (uint8_t _cepin, uint8_t _cspin, uint8_t _rx, uint8_t _tx, uint8_t _er) :
7979MySensor(_cepin, _cspin) {
8080 if (_rx != NULL ) {
8181 pinRx = _rx;
@@ -85,7 +85,7 @@ MySensor(_cepin, _cspin) {
8585 if (_tx != NULL ) {
8686 pinTx = _tx;
8787 pinMode (pinTx, OUTPUT);
88- ledMode = true ;
88+ ledMode = true ;
8989 }
9090 if (_er != NULL ) {
9191 pinEr = _er;
@@ -132,7 +132,7 @@ void MyMQTT::processMQTTMessage(char *inputString, int inputPos) {
132132 buffer[0 ]= 0 ;
133133 buffsize = 0 ;
134134#ifdef TCPDUMP
135- Serial.print (" <<" );
135+ Serial.print (" <<" );
136136 char buf[4 ];
137137 for (int a=0 ; a<inputPos; a++) { sprintf (buf," %02X " ,(byte)inputString[a]); Serial.print (buf); } Serial.println (" " );
138138#endif
@@ -165,14 +165,14 @@ void MyMQTT::processMQTTMessage(char *inputString, int inputPos) {
165165 }
166166 if (buffsize > 0 ) {
167167#ifdef TCPDUMP
168- Serial.print (" >>" );
168+ Serial.print (" >>" );
169169 char buf[4 ];
170- for (int a=0 ; a<buffsize; a++) { sprintf (buf," %02X " ,(byte)buffer[a]); Serial.print (buf); } Serial.println (" " );
170+ for (int a=0 ; a<buffsize; a++) { sprintf (buf," %02X " ,(byte)buffer[a]); Serial.print (buf); } Serial.println (" " );
171171#endif
172172 dataCallback (buffer,&buffsize);
173173 }
174174 // We publish everything we get, we dont care if its subscribed or not!
175- if ((byte)inputString[0 ] >> 4 == MQTTPUBLISH || (MQTT_SEND_SUBSCRIPTION && (byte)inputString[0 ] >> 4 == MQTTSUBSCRIBE)) {
175+ if ((byte)inputString[0 ] >> 4 == MQTTPUBLISH || (MQTT_SEND_SUBSCRIPTION && (byte)inputString[0 ] >> 4 == MQTTSUBSCRIBE)) {
176176 buffer[0 ]= 0 ;
177177 buffsize = 0 ;
178178 if ((byte)inputString[0 ] >> 4 == MQTTSUBSCRIBE) {
@@ -194,19 +194,19 @@ void MyMQTT::processMQTTMessage(char *inputString, int inputPos) {
194194 } else if (i==3 ) {
195195 char match=0 ;
196196 for (int j=0 ; strcpy_P (convBuf, (char *)pgm_read_word (&(sType [j]))) ; j++) {
197- if (strcmp (str,convBuf)==0 ) {
198- match=j;
197+ if (strcmp (str,convBuf)==0 ) {
198+ match=j;
199199 break ;
200200 }
201- }
201+ }
202202 msg.type = match;
203203 }
204204 i++;
205205 }
206206 if ((char )inputString[1 ] > (char )(inputString[3 ]+2 ) && !((byte)inputString[0 ] >> 4 == MQTTSUBSCRIBE)) {
207207 strcpy (convBuf,inputString+(inputString[3 ]+4 ));
208208 msg.set (convBuf);
209- } else {
209+ } else {
210210 msg.set (" " );
211211 }
212212 msg.sender = GATEWAY_ADDRESS;
@@ -227,7 +227,7 @@ void MyMQTT::SendMQTT(MyMessage &msg) {
227227 if (msg.isAck ()) {
228228 Serial.println (" msg is ack!" );
229229 if (msg.sender ==255 && mGetCommand (msg)==C_INTERNAL && msg.type ==I_ID_REQUEST) {
230- // TODO: sending ACK request on id_response fucks node up. doesn't work.
230+ // TODO: sending ACK request on id_response fucks node up. doesn't work.
231231 // The idea was to confirm id and save to EEPROM_LATEST_NODE_ADDRESS.
232232 }
233233 } else {
@@ -239,11 +239,11 @@ void MyMQTT::SendMQTT(MyMessage &msg) {
239239 saveState (EEPROM_LATEST_NODE_ADDRESS,newNodeID);
240240 }
241241 if (mGetCommand (msg)==C_INTERNAL && msg.type ==I_CONFIG) { // CONFIG
242- // As for now there is only one 'config' request.
242+ // As for now there is only one 'config' request.
243243 // We force SI! Resistance is futile!
244244 //
245- // Todo : Support for more config types, Maybe just read from own EEPROM?
246- // Use internal EEPROM_CONTROLLER_CONFIG_ADDRESS and special MQTT address to write to
245+ // Todo : Support for more config types, Maybe just read from own EEPROM?
246+ // Use internal EEPROM_CONTROLLER_CONFIG_ADDRESS and special MQTT address to write to
247247 // EEPROM_CONTROLLER_CONFIG_ADDRESS & EEPROM_LOCAL_CONFIG_ADDRESS
248248 msg.destination = msg.sender ; // NodeID
249249 msg.sender = GATEWAY_ADDRESS;
@@ -273,10 +273,10 @@ void MyMQTT::SendMQTT(MyMessage &msg) {
273273 mSetVersion (msg, PROTOCOL_VERSION);
274274 txBlink (1 );
275275 if (!sendRoute (msg)) errBlink (1 );
276- // if (sendRoute(msg)) saveState(EEPROM_LATEST_NODE_ADDRESS,newNodeID); // If send OK save to eeprom. DOES NOT ALWAYS RETURN 'OK'!?
276+ // if (sendRoute(msg)) saveState(EEPROM_LATEST_NODE_ADDRESS,newNodeID); // If send OK save to eeprom. DOES NOT ALWAYS RETURN 'OK'!?
277277 } else if (mGetCommand (msg)!=0 ) {
278278 if (mGetCommand (msg)==3 ) msg.type =msg.type +38 ;
279- buffer[buffsize++] = MQTTPUBLISH << 4 ; // 0:
279+ buffer[buffsize++] = MQTTPUBLISH << 4 ; // 0:
280280 buffer[buffsize++] = 0x09 ; // 1: Remaining length with no payload, we'll set this later to correct value, buffsize -2
281281 buffer[buffsize++] = 0x00 ; // 2: Length MSB (Remaing length can never exceed ff,so MSB must be 0!)
282282 buffer[buffsize++] = 0x08 ; // 3: Length LSB (ADDR), We'll set this later
@@ -297,11 +297,11 @@ void MyMQTT::SendMQTT(MyMessage &msg) {
297297#ifdef TCPDUMP
298298 Serial.print (" >>" );
299299 char buf[4 ];
300- for (int a=0 ; a<buffsize; a++) { sprintf (buf," %02X " ,(byte)buffer[a]); Serial.print (buf); } Serial.println (" " );
300+ for (int a=0 ; a<buffsize; a++) { sprintf (buf," %02X " ,(byte)buffer[a]); Serial.print (buf); } Serial.println (" " );
301301#endif
302302 dataCallback (buffer,&buffsize);
303303 }
304- }
304+ }
305305}
306306
307307boolean MyMQTT::isLedMode () {
@@ -350,7 +350,7 @@ void MyMQTT::errBlink(uint8_t cnt) {
350350char MyMQTT::strncpysType_retL (char *str, char index, char start) {
351351 char c;
352352 char l;
353- char *p = (char *)pgm_read_word (&(sType [index]));
353+ char *p = (char *)pgm_read_word (&(sType [index]));
354354 str+=start;
355355 while ((c = pgm_read_byte (p))) {
356356 *str=c;
0 commit comments