Skip to content

Commit 577c02e

Browse files
committed
Small changes for testing ESP8266 AT based devices.
1 parent f1c3c13 commit 577c02e

File tree

3 files changed

+17
-9
lines changed

3 files changed

+17
-9
lines changed

library.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name=thinger.io
2-
version=2.6.0
2+
version=2.6.1
33
author=Alvaro Luis Bustamante <[email protected]>
44
maintainer=Thinger.io <[email protected]>
55
sentence=Arduino library for the Thinger.io Internet of Things Platform.

src/ThingerClient.h

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -117,15 +117,20 @@ class ThingerClient : public thinger::thinger {
117117

118118
size_t written = client_.write(temp_data_, out_size_);
119119
bool success = written == out_size_;
120-
free(temp_data_);
121-
temp_data_ = NULL;
122-
out_size_ = 0;
123120

124-
#ifdef _DEBUG_
121+
#ifdef _DEBUG_
125122
Serial.print(F(" ["));
126123
Serial.print(success ? F("OK") : F("FAIL"));
127124
Serial.println(F("]"));
128-
#endif
125+
if(!success){
126+
THINGER_DEBUG_VALUE("THINGER", "Expected:", out_size_);
127+
THINGER_DEBUG_VALUE("THINGER", "Wrote:", written);
128+
}
129+
#endif
130+
131+
free(temp_data_);
132+
temp_data_ = NULL;
133+
out_size_ = 0;
129134

130135
//FIXME Without this small delay or activating the debug (which takes time), the CC3200 does not work well. Why?
131136
#ifdef __CC3200R1M1RGC__

src/thinger/thinger.h

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -181,9 +181,12 @@ namespace thinger{
181181
encoder.pb_encode_varint(MESSAGE);
182182
encoder.pb_encode_varint(sink.bytes_written());
183183
encoder.encode(message);
184-
bool result = write(NULL, 0, true);
185-
if(!result) disconnected();
186-
return result;
184+
return write(NULL, 0, true);
185+
/* TODO test this properly. Some devices (like AT based ones)
186+
* may fail to write, but are not necessarily disconnected */
187+
//bool result = write(NULL, 0, true);
188+
//if(!result) disconnected();
189+
//return result;
187190
}
188191

189192
void handle(unsigned long current_time, bool bytes_available)

0 commit comments

Comments
 (0)