Skip to content

Commit

Permalink
Merge branch 'development'
Browse files Browse the repository at this point in the history
  • Loading branch information
hathach committed Oct 18, 2016
2 parents a9a577c + c18c870 commit 42559f9
Show file tree
Hide file tree
Showing 97 changed files with 36,188 additions and 37,966 deletions.
13 changes: 13 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
# 0.6.1

- fix #46 : delayMicroseconds() and micros() are not correct
- add #60 pulseIn() function
- fix #61 : mqtt publish without requiring to subcribe
- resolve #62 : make sure while(!Serial) have delay() and add comment to explain why
- add flow-control for USB Serial
- fix HTTPServer example issue due to modern browse's parallel loading
- fix accessing failed malloc pointer
- solve #59 worst-case scenario for mqtt keepalive, causing AWS disconnection
- solve #59 AWS reconnection issue
- add MQTT setBufferSize() to explicitly change the TX/RX for mqtt client. Default is 256 bytes each

# 0.6.0

- Increase Arduino code size from 128KB to 256KB
Expand Down
5 changes: 0 additions & 5 deletions cores/maple/adafruit_feather.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -761,11 +761,6 @@ void adafruit_wifi_disconnect_callback(void)
//--------------------------------------------------------------------+
// Debug
//--------------------------------------------------------------------+
void AdafruitFeather::printThreadlist(void)
{
sdep(SDEP_CMD_THREADLIST_PRINT, 0, NULL, NULL, NULL);
}

int AdafruitFeather::dbgHeapTotal(void)
{
return heap_get_total_size();
Expand Down
1 change: 0 additions & 1 deletion cores/maple/adafruit_feather.h
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,6 @@ class AdafruitFeather : public AdafruitSDEP
void printVersions (Print& p = Serial);
void printNetwork (Print& p = Serial);
void printEncryption (int32_t enc, Print& p = Serial);
void printThreadlist (void);

// Debug functions
int dbgHeapTotal (void);
Expand Down
37 changes: 29 additions & 8 deletions cores/maple/adafruit_tcp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,18 @@

/******************************************************************************/
/*!
@brief
@brief Class init
*/
/******************************************************************************/
void AdafruitTCP::reset()
void AdafruitTCP::init()
{
_tcp_handle = NULL;
_connected = false;

_bytesRead = 0;
_remote_ip = 0;
_remote_port = 0;

_tls_verification = true;
_tls_context = NULL;

Expand All @@ -56,9 +60,6 @@ void AdafruitTCP::reset()
_tls_local_cert = NULL;
_tls_local_certlen = 0;

_bytesRead = 0;
_remote_ip = 0;
_remote_port = 0;
_packet_buffering = false;
_verbose = false;

Expand All @@ -67,14 +68,27 @@ void AdafruitTCP::reset()
_disconnect_callback = NULL;
}

void AdafruitTCP::disconnect_cleanup( void )
{
_tcp_handle = NULL;
_connected = false;

_bytesRead = 0;
_remote_ip = 0;
_remote_port = 0;

_tls_context = NULL;
_tls_identity = NULL;
}

/******************************************************************************/
/*!
@brief Constructor
*/
/******************************************************************************/
AdafruitTCP::AdafruitTCP(uint8_t interface)
{
this->reset();
this->init();

_interface = interface;
}
Expand All @@ -86,7 +100,7 @@ AdafruitTCP::AdafruitTCP(uint8_t interface)
/******************************************************************************/
AdafruitTCP::AdafruitTCP ( uint8_t interface, tcp_handle_t handle )
{
this->reset();
this->init();

_tcp_handle = handle;
_interface = interface;
Expand Down Expand Up @@ -243,7 +257,12 @@ int AdafruitTCP::connectSSL(const char* host, uint16_t port)

bool AdafruitTCP::tlsSetIdentity(char const* private_key, uint8_t const* local_cert, uint16_t local_certlen)
{
#ifdef DEBUG_AWS_PRIVATE_KEY
_tls_private_key = DEBUG_AWS_PRIVATE_KEY;
#else
_tls_private_key = private_key;
#endif

_tls_local_cert = local_cert;
_tls_local_certlen = local_certlen;

Expand Down Expand Up @@ -491,7 +510,9 @@ void AdafruitTCP::stop()
if ( _tls_context ) free_named("TCP TLS Context" , _tls_context);
if ( _tls_identity) free_named("TCP TLS Identity", _tls_identity);

this->reset();
// Don't invoke disconnect callback since callback normally call stop() --> recursive

this->disconnect_cleanup();

DBG_HEAP();
}
Expand Down
15 changes: 8 additions & 7 deletions cores/maple/adafruit_tcp.h
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,13 @@ class AdafruitTCP : public Client, public AdafruitSDEP

protected:
tcp_handle_t _tcp_handle;
bool _connected;
uint8_t _interface;
bool _connected;

uint32_t _bytesRead;

uint32_t _remote_ip;
uint16_t _remote_port;

bool _tls_verification;

Expand All @@ -127,11 +132,6 @@ class AdafruitTCP : public Client, public AdafruitSDEP
const uint8_t* _tls_local_cert;
uint16_t _tls_local_certlen;

uint32_t _bytesRead;

uint32_t _remote_ip;
uint16_t _remote_port;

// If enabled, data is written to a buffer until the network packet is full
// (~1500 bytes) or until .flush() is called
// Default = false (buffering disabled)
Expand All @@ -143,7 +143,8 @@ class AdafruitTCP : public Client, public AdafruitSDEP

bool connect_internal ( uint32_t ipv4, uint16_t port, uint8_t is_tls);
void install_callback ( void );
void reset ( void );
void init ( void );
void disconnect_cleanup ( void );
void get_peer_info ( void );
bool interface_connected ( void );

Expand Down
1 change: 1 addition & 0 deletions cores/maple/adafruit_tcp_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ bool AdafruitTCPServer::listen(bool first_time)
uint32_t this_value = (uint32_t) this;

_tcp_handle = malloc_named("TCP Server", TCP_SOCKET_HANDLE_SIZE);
VERIFY( _tcp_handle != NULL );

sdep_cmd_para_t para_arr[] =
{
Expand Down
4 changes: 4 additions & 0 deletions cores/maple/io.h
Original file line number Diff line number Diff line change
Expand Up @@ -225,4 +225,8 @@ void shiftOut(uint8 dataPin, uint8 clockPin, uint8 bitOrder, uint8 value);

uint8_t shiftIn(uint8_t dataPin, uint8_t clockPin, uint8_t bitOrder);

uint32_t pulseIn( uint32_t ulPin, uint32_t ulState, uint32_t ulTimeout = 1000000L );

#define pulseInLong pulseIn

#endif
2 changes: 1 addition & 1 deletion cores/maple/libmaple/adafruit_featherlib.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@

//------------- Arduino Shared Structure -------------//
#define CFG_ARDUINO_CODE_MAGIC 0xDEC0DED
#define CFG_ARDUINO_CODE_VERSION "0.6.0"
#define CFG_ARDUINO_CODE_VERSION "0.6.1"

#define RESERVED_ XSTRING_CONCAT_(_rerserved, __LINE__)

Expand Down
Loading

0 comments on commit 42559f9

Please sign in to comment.