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 @@
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
*/
#include "ESPHost.h"
#include "CEspControl.h"
......
......@@ -16,7 +16,7 @@
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
*/
#pragma once
......
......@@ -95,14 +95,16 @@ int ESPHostLwIP::disconnectEventCb(CCtrlMsgWrapper *resp) {
}
bool ESPHostLwIP::initHW() {
if (wifiHwInitialized)
if (wifiHwInitialized) {
return true;
}
instance = this;
CEspControl::getInstance().listenForStationDisconnectEvent(disconnectEventCb);
CEspControl::getInstance().listenForInitEvent(initEventCb);
if (CEspControl::getInstance().initSpiDriver() != 0)
if (CEspControl::getInstance().initSpiDriver() != 0) {
return false;
}
uint32_t start = millis();
while (!wifiHwInitialized && (millis() - start < timeout)) {
......@@ -117,8 +119,9 @@ bool ESPHostLwIP::initHW() {
}
bool ESPHostLwIP::begin() {
if (!initHW())
if (!initHW()) {
return false;
}
ethernet_arch_lwip_begin();
if (!apMode) {
CEspControl::getInstance().setWifiMode(WIFI_MODE_STA);
......@@ -198,8 +201,9 @@ uint8_t ESPHostLwIP::status() {
}
uint8_t* ESPHostLwIP::macAddress(bool apMode, uint8_t *mac) {
if (!initHW())
if (!initHW()) {
return mac;
}
WifiMac_t MAC;
MAC.mode = apMode ? WIFI_MODE_AP : WIFI_MODE_STA;
ethernet_arch_lwip_begin();
......@@ -220,8 +224,9 @@ int ESPHostLwIP::channel() {
}
int32_t ESPHostLwIP::RSSI() {
if (!joined)
if (!joined) {
return 0;
}
ethernet_arch_lwip_begin();
CEspControl::getInstance().getAccessPointConfig(ap);
ethernet_arch_lwip_end();
......@@ -254,15 +259,18 @@ uint8_t ESPHostLwIP::encryptionType() {
}
int8_t ESPHostLwIP::scanNetworks(bool async) {
(void) async;
accessPoints.clear();
if (!initHW())
if (!initHW()) {
return -1;
}
ethernet_arch_lwip_begin();
int res = CEspControl::getInstance().getAccessPointScanList(accessPoints);
ethernet_arch_lwip_end();
wifiStatus = WL_SCAN_COMPLETED;
if (res != ESP_CONTROL_OK)
if (res != ESP_CONTROL_OK) {
return -1;
}
return accessPoints.size();
}
......@@ -310,8 +318,9 @@ int32_t ESPHostLwIP::RSSI(uint8_t networkItem) {
}
void ESPHostLwIP::lowPowerMode() {
if (!initHW())
if (!initHW()) {
return;
}
ethernet_arch_lwip_begin();
CEspControl::getInstance().setPowerSaveMode(1);
ethernet_arch_lwip_end();
......
......@@ -16,7 +16,7 @@
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
*/
#pragma once
......
......@@ -14,7 +14,7 @@ for dir in ./cores/rp2040 ./libraries/EEPROM ./libraries/I2S ./libraries/SingleF
./libraries/MouseBT ./libraries/SerialBT ./libraries/HID_Bluetooth \
./libraries/JoystickBLE ./libraries/KeyboardBLE ./libraries/MouseBLE \
./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 "*.ino" -exec astyle --suffix=none --options=./tests/astyle_examples.conf \{\} \;
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