Skip to content

Commit

Permalink
Clang format per @2bndy5 #39
Browse files Browse the repository at this point in the history
  • Loading branch information
TMRh20 committed Oct 15, 2023
1 parent a1c353a commit 778461e
Show file tree
Hide file tree
Showing 8 changed files with 228 additions and 237 deletions.
185 changes: 90 additions & 95 deletions Dns.cpp

Large diffs are not rendered by default.

3 changes: 1 addition & 2 deletions Dns.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
class DNSClient
{
public:

void begin(const IPAddress& aDNSServer);

/**
Expand All @@ -22,7 +21,7 @@ class DNSClient
* @result 1 if aIPAddrString was successfully converted to an IP address,
* else error code
*/
int inet_aton(const char *aIPAddrString, IPAddress& aResult);
int inet_aton(const char* aIPAddrString, IPAddress& aResult);

/**
* Resolve the given hostname to an IP address.
Expand Down
74 changes: 37 additions & 37 deletions RF24Client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ int RF24Client::connect(IPAddress ip, uint16_t port)
{
#if UIP_ACTIVE_OPEN > 0

//do{
// do{

stop();
uip_ipaddr_t ipaddr;
Expand Down Expand Up @@ -75,10 +75,10 @@ int RF24Client::connect(IPAddress ip, uint16_t port)
#endif
}
}
//delay(25);
//}while(millis()-timer < 175);
// delay(25);
// }while(millis()-timer < 175);

#endif //Active open enabled
#endif // Active open enabled

return 0;
}
Expand All @@ -105,7 +105,7 @@ int RF24Client::connect(const char* host, uint16_t port)
return connect(remote_addr, port);
}
#else // ! UIP_UDP
//Do something with the input parameters to prevent compile time warnings
// Do something with the input parameters to prevent compile time warnings
if (host) {
};
if (port) {
Expand Down Expand Up @@ -214,7 +214,7 @@ size_t RF24Client::_write(uip_userdata_t* u, const uint8_t* buf, size_t size)
size_t remain = size - total_written;
payloadSize = rf24_min(remain, UIP_TCP_MSS);

//RF24EthernetClass::tick();
// RF24EthernetClass::tick();
goto test2;
}
return u->out_pos;
Expand All @@ -227,9 +227,9 @@ size_t RF24Client::_write(uip_userdata_t* u, const uint8_t* buf, size_t size)

void uip_log(char* msg)
{
//Serial.println();
//Serial.println("** UIP LOG **");
//Serial.println(msg);
// Serial.println();
// Serial.println("** UIP LOG **");
// Serial.println(msg);
if (msg)
{
};
Expand All @@ -243,11 +243,11 @@ void serialip_appcall(void)

#if UIP_CONNECTION_TIMEOUT > 0
if (u && u->connectTimeout > 0) {
if(!u->initialData){
if (!u->initialData) {
u->connectTimer = millis();
u->initialData = true;
}else
if (millis() - u->connectTimer > u->connectTimeout){
}
else if (millis() - u->connectTimer > u->connectTimeout) {
u->state |= UIP_CLIENT_CLOSE;
u->connectTimer = millis();
IF_RF24ETHERNET_DEBUG_CLIENT(Serial.println(); Serial.print(millis()); Serial.println("UIP Client close(timeout)"););
Expand All @@ -264,9 +264,9 @@ void serialip_appcall(void)

if (u)
{
#if UIP_CONNECTION_TIMEOUT > 0
u->connectTimer = millis();
#endif
#if UIP_CONNECTION_TIMEOUT > 0
u->connectTimer = millis();
#endif
uip_conn->appstate = u;
IF_RF24ETHERNET_DEBUG_CLIENT(Serial.print(F("UIPClient allocated state: ")); Serial.println(u->state, BIN););
}
Expand All @@ -282,9 +282,9 @@ void serialip_appcall(void)
if (uip_newdata())
{
IF_RF24ETHERNET_DEBUG_CLIENT(Serial.println(); Serial.print(millis()); Serial.print(F(" UIPClient uip_newdata, uip_len:")); Serial.println(uip_len););
#if UIP_CONNECTION_TIMEOUT > 0
u->connectTimer = millis();
#endif
#if UIP_CONNECTION_TIMEOUT > 0
u->connectTimer = millis();
#endif

if (u->sent)
{
Expand Down Expand Up @@ -336,15 +336,15 @@ void serialip_appcall(void)
u->state &= ~UIP_CLIENT_RESTART;
u->hold = (u->out_pos = (u->windowOpened = (u->packets_out = false)));
u->restartTime = millis();
#if UIP_CONNECTION_TIMEOUT > 0
#if UIP_CONNECTION_TIMEOUT > 0
u->connectTimer = millis();
#endif
#endif
}

/*******Polling**********/
if (uip_poll() || uip_rexmit())
{
//IF_RF24ETHERNET_DEBUG_CLIENT( Serial.println(); Serial.println(F("UIPClient uip_poll")); );
// IF_RF24ETHERNET_DEBUG_CLIENT( Serial.println(); Serial.println(F("UIPClient uip_poll")); );

if (u->packets_out != 0)
{
Expand All @@ -359,24 +359,24 @@ void serialip_appcall(void)
// Only call this if the TCP window has already been re-opened, the connection is being polled, but no data
// has been acked
if (!(u->state & (UIP_CLIENT_CLOSE | UIP_CLIENT_REMOTECLOSED)))
{

if (u->windowOpened == true && u->state & UIP_CLIENT_RESTART && millis() - u->restartTime > u->restartInterval)
{
u->restartTime = millis();

if (u->windowOpened == true && u->state & UIP_CLIENT_RESTART && millis() - u->restartTime > u->restartInterval)
{
u->restartTime = millis();
#if defined RF24ETHERNET_DEBUG_CLIENT || defined ETH_DEBUG_L1
Serial.println();
Serial.print(millis());
#if UIP_CONNECTION_TIMEOUT > 0
Serial.print(F(" UIPClient Re-Open TCP Window, time remaining before abort: "));
Serial.println( UIP_CONNECTION_TIMEOUT - (millis() - u->connectTimer));
#endif
#if UIP_CONNECTION_TIMEOUT > 0
Serial.print(F(" UIPClient Re-Open TCP Window, time remaining before abort: "));
Serial.println(UIP_CONNECTION_TIMEOUT - (millis() - u->connectTimer));
#endif
#endif
u->restartInterval += 500;
u->restartInterval = rf24_min(u->restartInterval, 7000);
uip_restart();
u->restartInterval += 500;
u->restartInterval = rf24_min(u->restartInterval, 7000);
uip_restart();
}
}
}
}

/*******Close**********/
Expand Down Expand Up @@ -434,10 +434,10 @@ uip_userdata_t* RF24Client::_allocateData()
data->out_pos = 0;
data->hold = 0;
data->initialData = false;
#if (UIP_CONNECTION_TIMEOUT > 0)
data->connectTimer = millis();
data->connectTimeout = UIP_CONNECTION_TIMEOUT;
#endif
#if (UIP_CONNECTION_TIMEOUT > 0)
data->connectTimer = millis();
data->connectTimeout = UIP_CONNECTION_TIMEOUT;
#endif
return data;
}
}
Expand Down
4 changes: 2 additions & 2 deletions RF24Ethernet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -220,8 +220,8 @@ void RF24EthernetClass::tick()
yield();
#endif
#if defined(ARDUINO_ARCH_ESP32)
const TickType_t xDelay = 1 / portTICK_PERIOD_MS;
vTaskDelay( xDelay );
const TickType_t xDelay = 1 / portTICK_PERIOD_MS;
vTaskDelay(xDelay);
#endif

if (RF24Ethernet.network.update() == EXTERNAL_DATA_TYPE) {
Expand Down
Loading

0 comments on commit 778461e

Please sign in to comment.