Skip to content

Commit

Permalink
Minor changes to address Travis build failures
Browse files Browse the repository at this point in the history
Correct wifi_softap_set_station_info() function prototypes in lwip2 patch and NONOS_SDK patch
Add NmiTimSetFunc prototype to esp_systemapi.h - missing from SDK 1.5.0
  • Loading branch information
mikee47 committed Aug 15, 2018
1 parent 16c9592 commit e4b5087
Show file tree
Hide file tree
Showing 13 changed files with 24 additions and 25 deletions.
3 changes: 2 additions & 1 deletion Sming/Services/WebHelpers/escape.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,8 @@ char* uri_escape(char* dest, size_t dest_len, const char* src, int src_len)
}

assert(dest_len >= 1);
*dest = 0;
if (dest)
*dest = 0;

return ret;
}
Expand Down
2 changes: 1 addition & 1 deletion Sming/SmingCore/Data/Stream/FileStream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ void FileStream::close()

size_t FileStream::readMemoryBlock(char* data, size_t bufSize)
{
if (bufSize <= 0 || _pos >= _size)
if (!data || bufSize == 0 || _pos >= _size)
return 0;
size_t len = _size - _pos;
if (len > (size_t)bufSize)
Expand Down
4 changes: 2 additions & 2 deletions Sming/SmingCore/DriverPWM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ void DriverPWM::noAnalogWrite(uint8_t pin)

void DriverPWM::processingStatic(void* arg)
{
DriverPWM* self = (DriverPWM*)arg;
auto self = reinterpret_cast<DriverPWM*>(arg);
for (unsigned i = 0; i < self->_channels.count(); i++)
self->_channels[i].high();
}
Expand Down Expand Up @@ -119,6 +119,6 @@ void ChannelPWM::close()

void ChannelPWM::processingStatic(void* arg)
{
ChannelPWM* self = (ChannelPWM*)arg;
auto self = reinterpret_cast<ChannelPWM*>(arg);
digitalWrite(self->_pin, LOW);
}
5 changes: 0 additions & 5 deletions Sming/SmingCore/Network/FTPServerConnection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,6 @@ class FTPDataFileList : public FTPDataStream {
virtual void transferData(TcpConnectionEvent sourceEvent);
};

/*
* 13/8/2018 (mikee47)
*
* Rewritten using new filesystem api: we now have real file timestamps
*/
void FTPDataFileList::transferData(TcpConnectionEvent sourceEvent)
{
if (_completed)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ class WebSocketConnection {
HttpServerConnection& _connection;

ws_frame_type_t _frameType = WS_FRAME_TEXT;
WsFrameInfo _controlFrame;
WsFrameInfo _controlFrame = { 0 };

ws_parser_t _parser;

Expand Down
4 changes: 2 additions & 2 deletions Sming/SmingCore/Network/TcpConnection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ err_t TcpConnection::onSent(uint16_t len)
debug_d("TCP sent: %d", len);

//debug_d("%d %d", tcp->state, tcp->flags); // WRONG!
if (len >= 0 && _tcp && getAvailableWriteSize() > 0)
if (_tcp && getAvailableWriteSize() > 0)
onReadyToSendData(eTCE_Sent);

return ERR_OK;
Expand Down Expand Up @@ -426,7 +426,7 @@ err_t TcpConnection::staticOnReceive(void* arg, tcp_pcb* tcp, pbuf* p, err_t err
{
//Serial.println("echo_recv!");

auto con = (TcpConnection*)arg;
auto con = reinterpret_cast<TcpConnection*>(arg);
if (!con) {
if (p) {
/* Inform TCP that we have taken the data. */
Expand Down
2 changes: 0 additions & 2 deletions Sming/SmingCore/Network/TcpConnection.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,6 @@ class TcpConnection;
typedef Delegate<void(TcpConnection&)> TcpConnectionDestroyedDelegate;

class TcpConnection {
// friend class TcpServer;

public:
TcpConnection(bool autoDestruct) : _autoSelfDestruct(autoDestruct)
{}
Expand Down
2 changes: 1 addition & 1 deletion Sming/SmingCore/Network/UdpConnection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ void UdpConnection::onReceive(pbuf* buf, IPAddress remoteIP, uint16_t remotePort

void UdpConnection::staticOnReceive(void* arg, struct udp_pcb* pcb, struct pbuf* p, LWIP_IP_ADDR_T* addr, u16_t port)
{
auto conn = (UdpConnection*)arg;
auto conn = reinterpret_cast<UdpConnection*>(arg);
if (conn) {
IPAddress reip = addr ? IPAddress(*addr) : IPAddress();
conn->onReceive(p, reip, port);
Expand Down
3 changes: 2 additions & 1 deletion Sming/SmingCore/core_esp8266_si2c.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,9 @@ static void twi_delay(unsigned char v)
unsigned int i;
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-but-set-variable"
volatile unsigned reg;
for (i = 0; i < v; i++)
unsigned reg = GPI;
reg = GPI;
#pragma GCC diagnostic pop
}

Expand Down
6 changes: 1 addition & 5 deletions Sming/Wiring/WString.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -878,18 +878,14 @@ String toHexString(const uint8_t* data, unsigned sz, char sep)
unsigned String::split(char delim, Vector<String>& splits) const
{
splits.removeAllElements();
unsigned splitCount = 0;
unsigned splitIndex = 0;
unsigned startIndex = 0;
for (unsigned i = 0; i < _len; i++)
if (_buffer[i] == delim) {
splits.addElement(substring(startIndex, i));
splitIndex++;
startIndex = i + 1;
splitCount++;
}

splits.addElement(substring(startIndex, _len));

return splitCount + 1;
return splits.count();
}
3 changes: 3 additions & 0 deletions Sming/system/include/esp_systemapi.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,9 @@ extern void uart_tx_one_char(char ch);
extern void ets_intr_lock();
extern void ets_intr_unlock();

// Missing from SDK 1.5.x
extern void NmiTimSetFunc(void (*func)(void));

#endif /* SDK_INTERNAL */

// CPU Frequency
Expand Down
2 changes: 1 addition & 1 deletion Sming/third-party/.patches/ESP8266_NONOS_SDK.patch
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ index dbd171d..f191575 100644
};

uint8 wifi_softap_get_station_num(void);
+bool wifi_softap_set_station_info(const uint8_t[], const ip_addr_t*);
+bool wifi_softap_set_station_info(const uint8_t mac[], const struct ip_addr*);
struct station_info * wifi_softap_get_station_info(void);
void wifi_softap_free_station_info(void);

11 changes: 8 additions & 3 deletions Sming/third-party/.patches/lwip2.patch
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,9 @@ index 842f4fe..7550a72 100644
LWIP_LIB=liblwip2.a \
LWIP_LIB_RELEASE=$(LWIP_LIB_RELEASE) \
LWIP_INCLUDES_RELEASE=$(LWIP_INCLUDES_RELEASE) \
diff --git a/glue/esp-missing.h b/glue/esp-missing.h
index 0e42073..4cb5d6c 100644
diff --git a/glue/esp-missing.h b/glue/esp-missing.h
index 0e42073..5946637 100644
--- a/glue/esp-missing.h
+++ b/glue/esp-missing.h
@@ -9,9 +9,9 @@
Expand All @@ -59,7 +60,7 @@ index 0e42073..4cb5d6c 100644

struct netif* eagle_lwip_getif (int netif_index);

@@ -27,10 +27,10 @@ int ets_memcmp (const void*, const void*, size_t n);
@@ -27,13 +27,13 @@ int ets_memcmp (const void*, const void*, size_t n);
void *ets_memset (void *s, int c, size_t n);
void *ets_memcpy (void *dest, const void *src, size_t n);

Expand All @@ -73,4 +74,8 @@ index 0e42073..4cb5d6c 100644
+//void ets_timer_setfn (ETSTimer *t, ETSTimerFunc *fn, void *parg);

struct ip_addr;
void wifi_softap_set_station_info (uint8_t* mac, struct ip_addr*);
-void wifi_softap_set_station_info (uint8_t* mac, struct ip_addr*);
+bool wifi_softap_set_station_info (const uint8_t mac[], const struct ip_addr*);

#define os_intr_lock ets_intr_lock
#define os_intr_unlock ets_intr_unlock

0 comments on commit e4b5087

Please sign in to comment.