Skip to content

Commit 8efaa64

Browse files
authored
Merge branch 'master' into feature/issue-2246-multi-wifi-hidden
2 parents c82c684 + e920564 commit 8efaa64

File tree

11 files changed

+73
-24
lines changed

11 files changed

+73
-24
lines changed

bootloaders/eboot/eboot.c

+23-14
Original file line numberDiff line numberDiff line change
@@ -21,20 +21,20 @@ extern unsigned char _gzip_dict;
2121
extern void ets_wdt_enable(void);
2222
extern void ets_wdt_disable(void);
2323

24+
// Converts bit of a string into a uint32
25+
#define S(a,b,c,d) ( (((uint32_t)a) & 0xff) | (((uint32_t)b) << 8) | (((uint32_t)c) << 16) | (((uint32_t)d)<<24) )
26+
2427
int print_version(const uint32_t flash_addr)
2528
{
2629
uint32_t ver;
2730
if (SPIRead(flash_addr + APP_START_OFFSET + sizeof(image_header_t) + sizeof(section_header_t), &ver, sizeof(ver))) {
2831
return 1;
2932
}
30-
char fmt[7];
31-
fmt[0] = 'v';
32-
fmt[1] = '%';
33-
fmt[2] = '0';
34-
fmt[3] = '8';
35-
fmt[4] = 'x';
36-
fmt[5] = '\n';
37-
fmt[6] = 0;
33+
// We don't have BSS and can't print from flash, so build up string
34+
// 4 chars at a time. Smaller code than byte-wise assignment.
35+
uint32_t fmt[2];
36+
fmt[0] = S('v', '%', '0', '8');
37+
fmt[1] = S('x', '\n', 0, 0);
3838
ets_printf((const char*) fmt, ver);
3939
return 0;
4040
}
@@ -234,26 +234,32 @@ int main()
234234
}
235235

236236
if (cmd.action == ACTION_COPY_RAW) {
237-
ets_putc('c'); ets_putc('p'); ets_putc(':');
237+
uint32_t cp = S('c', 'p', ':', 0);
238+
ets_printf((const char *)cp);
238239

239240
ets_wdt_disable();
240241
res = copy_raw(cmd.args[0], cmd.args[1], cmd.args[2], false);
241242
ets_wdt_enable();
242243

243-
ets_putc('0'+res); ets_putc('\n');
244+
cp = S('0' + res, '\n', 0, 0 );
245+
ets_printf((const char *)cp);
244246
#if 0
245247
//devyte: this verify step below (cmp:) only works when the end of copy operation above does not overwrite the
246248
//beginning of the image in the empty area, see #7458. Disabling for now.
247249
//TODO: replace the below verify with hash type, crc, or similar.
248250
// Verify the copy
249-
ets_putc('c'); ets_putc('m'); ets_putc('p'); ets_putc(':');
251+
uint32_t v[2];
252+
v[0] = S('c', 'm', 'p', ':');
253+
v[1] = 0;
254+
ets_printf(const char *)v);
250255
if (res == 0) {
251256
ets_wdt_disable();
252257
res = copy_raw(cmd.args[0], cmd.args[1], cmd.args[2], true);
253258
ets_wdt_enable();
254259
}
255260

256-
ets_putc('0'+res); ets_putc('\n');
261+
cp = S('0' + res, '\n', 0, 0 );
262+
ets_printf((const char *)cp);
257263
#endif
258264
if (res == 0) {
259265
cmd.action = ACTION_LOAD_APP;
@@ -268,8 +274,11 @@ int main()
268274
if (cmd.action == ACTION_LOAD_APP) {
269275
ets_putc('l'); ets_putc('d'); ets_putc('\n');
270276
res = load_app_from_flash_raw(cmd.args[0]);
271-
//we will get to this only on load fail
272-
ets_putc('e'); ets_putc(':'); ets_putc('0'+res); ets_putc('\n');
277+
// We will get to this only on load fail
278+
uint32_t e[2];
279+
e[0] = S('e', ':', '0' + res, '\n' );
280+
e[1] = 0;
281+
ets_printf((const char*)e);
273282
}
274283

275284
if (res) {

bootloaders/eboot/eboot.elf

-8 Bytes
Binary file not shown.

cores/esp8266/Schedule.cpp

+17
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,20 @@
1+
/*
2+
Schedule.cpp - Scheduled functions.
3+
Copyright (c) 2020 esp8266/Arduino
4+
5+
This file is part of the esp8266 core for Arduino environment.
6+
This library is free software; you can redistribute it and/or
7+
modify it under the terms of the GNU Lesser General Public
8+
License as published by the Free Software Foundation; either
9+
version 2.1 of the License, or (at your option) any later version.
10+
This library is distributed in the hope that it will be useful,
11+
but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13+
Lesser General Public License for more details.
14+
You should have received a copy of the GNU Lesser General Public
15+
License along with this library; if not, write to the Free Software
16+
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17+
*/
118

219
#include <assert.h>
320

cores/esp8266/Schedule.h

+18
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,21 @@
1+
/*
2+
Schedule.h - Header file for scheduled functions.
3+
Copyright (c) 2020 esp8266/Arduino
4+
5+
This file is part of the esp8266 core for Arduino environment.
6+
This library is free software; you can redistribute it and/or
7+
modify it under the terms of the GNU Lesser General Public
8+
License as published by the Free Software Foundation; either
9+
version 2.1 of the License, or (at your option) any later version.
10+
This library is distributed in the hope that it will be useful,
11+
but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13+
Lesser General Public License for more details.
14+
You should have received a copy of the GNU Lesser General Public
15+
License along with this library; if not, write to the Free Software
16+
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17+
*/
18+
119
#ifndef ESP_SCHEDULE_H
220
#define ESP_SCHEDULE_H
321

libraries/EEPROM/EEPROM.cpp

+9-4
Original file line numberDiff line numberDiff line change
@@ -72,17 +72,22 @@ void EEPROMClass::begin(size_t size) {
7272
_dirty = false; //make sure dirty is cleared in case begin() is called 2nd+ time
7373
}
7474

75-
void EEPROMClass::end() {
76-
if (!_size)
77-
return;
75+
bool EEPROMClass::end() {
76+
bool retval;
77+
78+
if(!_size) {
79+
return false;
80+
}
7881

79-
commit();
82+
retval = commit();
8083
if(_data) {
8184
delete[] _data;
8285
}
8386
_data = 0;
8487
_size = 0;
8588
_dirty = false;
89+
90+
return retval;
8691
}
8792

8893

libraries/EEPROM/EEPROM.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class EEPROMClass {
3535
uint8_t read(int const address);
3636
void write(int const address, uint8_t const val);
3737
bool commit();
38-
void end();
38+
bool end();
3939

4040
uint8_t * getDataPtr();
4141
uint8_t const * getConstDataPtr() const;

libraries/ESP8266WiFi/src/ESP8266WiFiGeneric.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ void ESP8266WiFiGenericClass::_eventCallback(void* arg)
254254
* Return the current channel associated with the network
255255
* @return channel (1-13)
256256
*/
257-
int32_t ESP8266WiFiGenericClass::channel(void) {
257+
uint8_t ESP8266WiFiGenericClass::channel(void) {
258258
return wifi_get_channel();
259259
}
260260

libraries/ESP8266WiFi/src/ESP8266WiFiGeneric.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ class ESP8266WiFiGenericClass {
7474
WiFiEventHandler onSoftAPModeProbeRequestReceived(std::function<void(const WiFiEventSoftAPModeProbeRequestReceived&)>);
7575
WiFiEventHandler onWiFiModeChange(std::function<void(const WiFiEventModeChange&)>);
7676

77-
int32_t channel(void);
77+
uint8_t channel(void);
7878

7979
bool setSleepMode(WiFiSleepType_t type, uint8_t listenInterval = 0);
8080

libraries/ESP8266WiFi/src/ESP8266WiFiSTA.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -686,7 +686,7 @@ String ESP8266WiFiSTAClass::BSSIDstr(void) {
686686
* Return the current network RSSI.
687687
* @return RSSI value
688688
*/
689-
int32_t ESP8266WiFiSTAClass::RSSI(void) {
689+
int8_t ESP8266WiFiSTAClass::RSSI(void) {
690690
return wifi_station_get_rssi();
691691
}
692692

libraries/ESP8266WiFi/src/ESP8266WiFiSTA.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ class ESP8266WiFiSTAClass {
8181
uint8_t * BSSID();
8282
String BSSIDstr();
8383

84-
int32_t RSSI();
84+
int8_t RSSI();
8585

8686
static void enableInsecureWEP (bool enable = true) { _useInsecureWEP = enable; }
8787

libraries/Netdump/library.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ sentence=tcpdump-like logger for esp8266/Arduino
66
paragraph=Dumps input / output packets on "Print"able type, or provide a TCP server for the real tcpdump. Check examples. Some other unrelated and independant tools are included.
77
category=Communication
88
url=https://
9-
architectures=esp8266 lwip
9+
architectures=esp8266

0 commit comments

Comments
 (0)