Unverified Commit 972b7f53 authored by Earle F. Philhower, III's avatar Earle F. Philhower, III Committed by GitHub

Fix warning in lwip_ESPHost, add to styler (#1998)

parent fc894fba
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
You should have received a copy of the GNU Lesser General Public You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/ */
#include "ESPHost.h" #include "ESPHost.h"
#include "CEspControl.h" #include "CEspControl.h"
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
You should have received a copy of the GNU Lesser General Public You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/ */
#pragma once #pragma once
......
...@@ -95,14 +95,16 @@ int ESPHostLwIP::disconnectEventCb(CCtrlMsgWrapper *resp) { ...@@ -95,14 +95,16 @@ int ESPHostLwIP::disconnectEventCb(CCtrlMsgWrapper *resp) {
} }
bool ESPHostLwIP::initHW() { bool ESPHostLwIP::initHW() {
if (wifiHwInitialized) if (wifiHwInitialized) {
return true; return true;
}
instance = this; instance = this;
CEspControl::getInstance().listenForStationDisconnectEvent(disconnectEventCb); CEspControl::getInstance().listenForStationDisconnectEvent(disconnectEventCb);
CEspControl::getInstance().listenForInitEvent(initEventCb); CEspControl::getInstance().listenForInitEvent(initEventCb);
if (CEspControl::getInstance().initSpiDriver() != 0) if (CEspControl::getInstance().initSpiDriver() != 0) {
return false; return false;
}
uint32_t start = millis(); uint32_t start = millis();
while (!wifiHwInitialized && (millis() - start < timeout)) { while (!wifiHwInitialized && (millis() - start < timeout)) {
...@@ -117,8 +119,9 @@ bool ESPHostLwIP::initHW() { ...@@ -117,8 +119,9 @@ bool ESPHostLwIP::initHW() {
} }
bool ESPHostLwIP::begin() { bool ESPHostLwIP::begin() {
if (!initHW()) if (!initHW()) {
return false; return false;
}
ethernet_arch_lwip_begin(); ethernet_arch_lwip_begin();
if (!apMode) { if (!apMode) {
CEspControl::getInstance().setWifiMode(WIFI_MODE_STA); CEspControl::getInstance().setWifiMode(WIFI_MODE_STA);
...@@ -198,8 +201,9 @@ uint8_t ESPHostLwIP::status() { ...@@ -198,8 +201,9 @@ uint8_t ESPHostLwIP::status() {
} }
uint8_t* ESPHostLwIP::macAddress(bool apMode, uint8_t *mac) { uint8_t* ESPHostLwIP::macAddress(bool apMode, uint8_t *mac) {
if (!initHW()) if (!initHW()) {
return mac; return mac;
}
WifiMac_t MAC; WifiMac_t MAC;
MAC.mode = apMode ? WIFI_MODE_AP : WIFI_MODE_STA; MAC.mode = apMode ? WIFI_MODE_AP : WIFI_MODE_STA;
ethernet_arch_lwip_begin(); ethernet_arch_lwip_begin();
...@@ -220,8 +224,9 @@ int ESPHostLwIP::channel() { ...@@ -220,8 +224,9 @@ int ESPHostLwIP::channel() {
} }
int32_t ESPHostLwIP::RSSI() { int32_t ESPHostLwIP::RSSI() {
if (!joined) if (!joined) {
return 0; return 0;
}
ethernet_arch_lwip_begin(); ethernet_arch_lwip_begin();
CEspControl::getInstance().getAccessPointConfig(ap); CEspControl::getInstance().getAccessPointConfig(ap);
ethernet_arch_lwip_end(); ethernet_arch_lwip_end();
...@@ -254,15 +259,18 @@ uint8_t ESPHostLwIP::encryptionType() { ...@@ -254,15 +259,18 @@ uint8_t ESPHostLwIP::encryptionType() {
} }
int8_t ESPHostLwIP::scanNetworks(bool async) { int8_t ESPHostLwIP::scanNetworks(bool async) {
(void) async;
accessPoints.clear(); accessPoints.clear();
if (!initHW()) if (!initHW()) {
return -1; return -1;
}
ethernet_arch_lwip_begin(); ethernet_arch_lwip_begin();
int res = CEspControl::getInstance().getAccessPointScanList(accessPoints); int res = CEspControl::getInstance().getAccessPointScanList(accessPoints);
ethernet_arch_lwip_end(); ethernet_arch_lwip_end();
wifiStatus = WL_SCAN_COMPLETED; wifiStatus = WL_SCAN_COMPLETED;
if (res != ESP_CONTROL_OK) if (res != ESP_CONTROL_OK) {
return -1; return -1;
}
return accessPoints.size(); return accessPoints.size();
} }
...@@ -310,8 +318,9 @@ int32_t ESPHostLwIP::RSSI(uint8_t networkItem) { ...@@ -310,8 +318,9 @@ int32_t ESPHostLwIP::RSSI(uint8_t networkItem) {
} }
void ESPHostLwIP::lowPowerMode() { void ESPHostLwIP::lowPowerMode() {
if (!initHW()) if (!initHW()) {
return; return;
}
ethernet_arch_lwip_begin(); ethernet_arch_lwip_begin();
CEspControl::getInstance().setPowerSaveMode(1); CEspControl::getInstance().setPowerSaveMode(1);
ethernet_arch_lwip_end(); ethernet_arch_lwip_end();
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
You should have received a copy of the GNU Lesser General Public You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/ */
#pragma once #pragma once
......
...@@ -14,7 +14,7 @@ for dir in ./cores/rp2040 ./libraries/EEPROM ./libraries/I2S ./libraries/SingleF ...@@ -14,7 +14,7 @@ for dir in ./cores/rp2040 ./libraries/EEPROM ./libraries/I2S ./libraries/SingleF
./libraries/MouseBT ./libraries/SerialBT ./libraries/HID_Bluetooth \ ./libraries/MouseBT ./libraries/SerialBT ./libraries/HID_Bluetooth \
./libraries/JoystickBLE ./libraries/KeyboardBLE ./libraries/MouseBLE \ ./libraries/JoystickBLE ./libraries/KeyboardBLE ./libraries/MouseBLE \
./libraries/lwIP_w5500 ./libraries/lwIP_w5100 ./libraries/lwIP_enc28j60 \ ./libraries/lwIP_w5500 ./libraries/lwIP_w5100 ./libraries/lwIP_enc28j60 \
./libraries/SPISlave ; do ./libraries/SPISlave ./libraries/lwIP_ESPHost; do
find $dir -type f \( -name "*.c" -o -name "*.h" -o -name "*.cpp" \) -a \! -path '*api*' -exec astyle --suffix=none --options=./tests/astyle_core.conf \{\} \; find $dir -type f \( -name "*.c" -o -name "*.h" -o -name "*.cpp" \) -a \! -path '*api*' -exec astyle --suffix=none --options=./tests/astyle_core.conf \{\} \;
find $dir -type f -name "*.ino" -exec astyle --suffix=none --options=./tests/astyle_examples.conf \{\} \; find $dir -type f -name "*.ino" -exec astyle --suffix=none --options=./tests/astyle_examples.conf \{\} \;
done done
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment