Skip to content

Commit

Permalink
Cleanup warnings/minor issues
Browse files Browse the repository at this point in the history
  • Loading branch information
TMRh20 committed Jul 31, 2020
1 parent 7d23534 commit 946f00b
Show file tree
Hide file tree
Showing 15 changed files with 48 additions and 34 deletions.
2 changes: 1 addition & 1 deletion RF24Ethernet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ void RF24EthernetClass::setMac(uint16_t address){
uip_seteth_addr(mac);
network.multicastRelay = 1;
#else
if(mac){}; //Dummy operation to prevent warnings if TAP not defined
if(mac[0]==1){}; //Dummy operation to prevent warnings if TAP not defined
#endif
RF24_Channel = RF24_Channel ? RF24_Channel : 97;
network.begin(RF24_Channel, address);
Expand Down
2 changes: 1 addition & 1 deletion examples/InteractiveServer_Mesh/HTML.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ static const char main_html_p2[] PROGMEM =
* This allows the HTML code to be modified as desired, with no need to change any other code
*/
void sendPage(EthernetClient& _client, const char* _pointer, size_t size ){
for(int i=0; i<size;i++){
for(uint16_t i=0; i<size;i++){
char c = pgm_read_byte(_pointer++);
_client.write(&c,1);
}
Expand Down
4 changes: 3 additions & 1 deletion examples/InteractiveServer_Mesh/InteractiveServer_Mesh.ino
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@ void loop() {
{
// If a request is received with enough characters, search for the / character
if (size >= 7) {
client.findUntil("/", "/");
char slash[] = {"/"};
client.findUntil(slash, slash);
char buf[3] = {" "};
if(client.available() >= 2){
buf[0] = client.read(); // Read in the first two characters from the request
Expand Down Expand Up @@ -180,5 +181,6 @@ static unsigned short generate_tcp_stats()

}
}
return 1;
}

2 changes: 1 addition & 1 deletion examples/InteractiveServer_Mesh_ESPWifi/HTML.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ static const char main_html_p2[] PROGMEM =
* This allows the HTML code to be modified as desired, with no need to change any other code
*/
void sendPage(EthernetClient& _client, const char* _pointer, size_t size ){
for(int i=0; i<size;i++){
for(uint16_t i=0; i<size;i++){
char c = pgm_read_byte(_pointer++);
_client.write(&c,1);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,8 @@ void loop() {
{
// If a request is received with enough characters, search for the / character
if (size >= 7) {
client.findUntil("/", "/");
char slash[] = {"/"};
client.findUntil(slash, slash);
char buf[3] = {" "};
if(client.available() >= 2){
buf[0] = client.read(); // Read in the first two characters from the request
Expand Down Expand Up @@ -246,5 +247,6 @@ static unsigned short generate_tcp_stats()

}
}
return 1;
}

2 changes: 1 addition & 1 deletion examples/SLIP_InteractiveServer/HTML.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ static const char main_html_p2[] PROGMEM =
* This allows the HTML code to be modified as desired, with no need to change any other code
*/
void sendPage(EthernetClient& _client, const char* _pointer, size_t size ){
for(int i=0; i<size;i++){
for(uint16_t i=0; i<size;i++){
char c = pgm_read_byte(_pointer++);
_client.write(&c,1);
}
Expand Down
4 changes: 3 additions & 1 deletion examples/SLIP_InteractiveServer/SLIP_InteractiveServer.ino
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,8 @@ void loop() {
{
// If a request is received with enough characters, search for the / character
if (size >= 7) {
client.findUntil("/", "/");
char slash[] = {"/"};
client.findUntil(slash, slash);
char buf[3] = {" "};
buf[0] = client.read(); // Read in the first two characters from the request
buf[1] = client.read();
Expand Down Expand Up @@ -201,5 +202,6 @@ static unsigned short generate_tcp_stats()

}
}
return 1;
}

22 changes: 14 additions & 8 deletions utility/psock.c
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,8 @@ buf_bufto(register struct psock_buf *buf, u8_t endmarker,
return BUF_FULL;
}
/*---------------------------------------------------------------------------*/
static char
//TMRh20: Comment this out to remove warnings. Protosockets not used by RF24Ethernet.
/*static char
send_data(register struct psock *s)
{
if(s->state != STATE_DATA_SENT || uip_rexmit()) {
Expand All @@ -154,9 +155,10 @@ send_data(register struct psock *s)
return 1;
}
return 0;
}
}*/
/*---------------------------------------------------------------------------*/
static char
//TMRh20: Comment this out to remove warnings. Protosockets not used by RF24Ethernet.
/*static char
data_acked(register struct psock *s)
{
if(s->state == STATE_DATA_SENT && uip_acked()) {
Expand All @@ -171,7 +173,7 @@ data_acked(register struct psock *s)
return 1;
}
return 0;
}
}*/
/*---------------------------------------------------------------------------*/
PT_THREAD(psock_send(register struct psock *s, const u8_t *buf,
unsigned int len))
Expand Down Expand Up @@ -204,7 +206,8 @@ PT_THREAD(psock_send(register struct psock *s, const u8_t *buf,
* && operator, which would cause only the data_acked() function
* to be called when it returns false.
*/
PT_WAIT_UNTIL(&s->psockpt, data_acked(s) & send_data(s));
//TMRh20: Comment this out to remove warnings. Protosockets not used by RF24Ethernet.
//PT_WAIT_UNTIL(&s->psockpt, data_acked(s) & send_data(s));
}

s->state = STATE_NONE;
Expand Down Expand Up @@ -235,7 +238,8 @@ PT_THREAD(psock_generator_send(register struct psock *s,
generate(arg);
}
/* Wait until all data is sent and acknowledged. */
PT_WAIT_UNTIL(&s->psockpt, data_acked(s) & send_data(s));
//TMRh20: Comment this out to remove warnings. Protosockets not used by RF24Ethernet.
//PT_WAIT_UNTIL(&s->psockpt, data_acked(s) & send_data(s));
} while(s->sendlen > 0);

s->state = STATE_NONE;
Expand Down Expand Up @@ -280,7 +284,8 @@ PT_THREAD(psock_readto(register struct psock *psock, unsigned char c))

do {
if(psock->readlen == 0) {
PT_WAIT_UNTIL(&psock->psockpt, psock_newdata(psock));
//TMRh20: Comment this out to remove warnings. Protosockets not used by RF24Ethernet.
//PT_WAIT_UNTIL(&psock->psockpt, psock_newdata(psock));
psock->state = STATE_READ;
psock->readptr = (u8_t *)uip_appdata;
psock->readlen = uip_datalen();
Expand All @@ -307,7 +312,8 @@ PT_THREAD(psock_readbuf(register struct psock *psock))

do {
if(psock->readlen == 0) {
PT_WAIT_UNTIL(&psock->psockpt, psock_newdata(psock));
//TMRh20: Comment this out to remove warnings. Protosockets not used by RF24Ethernet.
//PT_WAIT_UNTIL(&psock->psockpt, psock_newdata(psock));
//printf("Waited for newdata\n");
psock->state = STATE_READ;
psock->readptr = (u8_t *)uip_appdata;
Expand Down
2 changes: 1 addition & 1 deletion utility/psock.h
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ char psock_newdata(struct psock *s);
* \hideinitializer
*/
#define PSOCK_WAIT_UNTIL(psock, condition) \
PT_WAIT_UNTIL(&((psock)->pt), (condition));
PT_WAIT_UNTIL(&((psock)->pt), (condition))

#define PSOCK_WAIT_THREAD(psock, condition) \
PT_WAIT_THREAD(&((psock)->pt), (condition))
Expand Down
2 changes: 1 addition & 1 deletion utility/uip-fw.c
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ static void
fwcache_register(void)
{
struct fwcache_entry *fw;
int i, oldest;
uint16_t i, oldest;

oldest = FW_TIME;
fw = NULL;
Expand Down
4 changes: 2 additions & 2 deletions utility/uip-neighbor.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,9 @@ uip_neighbor_add(uip_ipaddr_t ipaddr, struct uip_neighbor_addr *addr)
int i, oldest;
u8_t oldest_time;

printf("Adding neighbor with link address %02x:%02x:%02x:%02x:%02x:%02x\n",
/* printf("Adding neighbor with link address %02x:%02x:%02x:%02x:%02x:%02x\n",
addr->addr.addr[0], addr->addr.addr[1], addr->addr.addr[2], addr->addr.addr[3],
addr->addr.addr[4], addr->addr.addr[5]);
addr->addr.addr[4], addr->addr.addr[5]);*/

/* Find the first unused entry or the oldest used entry. */
oldest_time = 0;
Expand Down
12 changes: 6 additions & 6 deletions utility/uip-split.c
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ uip_split_output(void)
#endif /* UIP_CONF_IPV6 */

/* Transmit the first packet. */
/* uip_fw_output();*/
tcpip_output();
uip_fw_output();
//tcpip_output();

/* Now, create the second packet. To do this, it is not enough to
just alter the length field, but we must also update the TCP
Expand Down Expand Up @@ -125,11 +125,11 @@ uip_split_output(void)
#endif /* UIP_CONF_IPV6 */

/* Transmit the second packet. */
/* uip_fw_output();*/
tcpip_output();
uip_fw_output();
//tcpip_output();
} else {
/* uip_fw_output();*/
tcpip_output();
uip_fw_output();
//tcpip_output();
}

}
Expand Down
8 changes: 5 additions & 3 deletions utility/uip.c
Original file line number Diff line number Diff line change
Expand Up @@ -110,12 +110,14 @@ const uip_ipaddr_t uip_netmask =
uip_ipaddr_t uip_hostaddr, uip_draddr, uip_netmask;
#endif /* UIP_FIXEDADDR */

#if UIP_UDP || UIP_BROADCAST
static const uip_ipaddr_t all_ones_addr =
#if UIP_CONF_IPV6
{0xffff,0xffff,0xffff,0xffff,0xffff,0xffff,0xffff,0xffff};
#else /* UIP_CONF_IPV6 */
{0xffff,0xffff};
#endif /* UIP_CONF_IPV6 */
#endif // UIP_UDP || UIP_BROADCAST
static const uip_ipaddr_t all_zeroes_addr =
#if UIP_CONF_IPV6
{0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000};
Expand Down Expand Up @@ -855,7 +857,7 @@ uip_process(u8_t flag)
the packet has been padded and we set uip_len to the correct
value.. */

if((BUF->len[0] << 8) + BUF->len[1] <= uip_len) {
if(( (uint8_t)(BUF->len[0] << 8) + BUF->len[1]) <= uip_len) {
uip_len = (BUF->len[0] << 8) + BUF->len[1];
#if UIP_CONF_IPV6
uip_len += 40; /* The length reported in the IPv6 header is the
Expand Down Expand Up @@ -1845,9 +1847,9 @@ uip_process(u8_t flag)
/* Calculate TCP checksum. */
BUF->tcpchksum = 0;
BUF->tcpchksum = ~(uip_tcpchksum());

#if UIP_UDP
ip_send_nolen:

#endif
#if UIP_CONF_IPV6
BUF->vtc = 0x60;
BUF->tcflow = 0x00;
Expand Down
10 changes: 5 additions & 5 deletions utility/uip_debug.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#include <inttypes.h>
#include <utility/uip_debug.h>
extern "C" {
#import "utility/uip.h"
#include "utility/uip.h"
}

struct uip_conn con[UIP_CONNS];
Expand Down Expand Up @@ -60,19 +60,19 @@ UIPDebug::uip_debug_printcon(struct uip_conn *lhs,struct uip_conn *rhs)
uip_debug_printbytes(lhs->rcv_nxt,4);
Serial.print(" -> ");
uip_debug_printbytes(rhs->rcv_nxt,4);
*((uint32_t *)&lhs->rcv_nxt[0]) = (uint32_t)rhs->rcv_nxt[0];
//*((uint32_t *)&lhs->rcv_nxt[0]) = (uint32_t)rhs->rcv_nxt[0];
Serial.println();
changed = true;
changed = false;
}
if ((uint32_t)lhs->snd_nxt[0] != (uint32_t)rhs->snd_nxt[0])
{
Serial.print(" snd_nxt: ");
uip_debug_printbytes(lhs->snd_nxt,4);
Serial.print(" -> ");
uip_debug_printbytes(rhs->snd_nxt,4);
*((uint32_t *)&lhs->snd_nxt[0]) = (uint32_t)rhs->snd_nxt[0];
//*((uint32_t *)&lhs->snd_nxt[0]) = (uint32_t)rhs->snd_nxt[0];
Serial.println();
changed = true;
changed = false;
}
if (lhs->len != rhs->len)
{
Expand Down
2 changes: 1 addition & 1 deletion utility/uip_debug.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef UIP_DEBUG_H
#define UIP_DEBUG_H
extern "C" {
#import "utility/uip.h"
#include "utility/uip.h"
}

class UIPDebug {
Expand Down

0 comments on commit 946f00b

Please sign in to comment.