1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-04-19 23:22:16 +03:00

Merge branch 'master' into feature/issue-2246-multi-wifi-hidden

This commit is contained in:
Erriez 2020-10-18 19:11:31 +02:00 committed by GitHub
commit 8efaa645c0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 73 additions and 24 deletions

View File

@ -21,20 +21,20 @@ extern unsigned char _gzip_dict;
extern void ets_wdt_enable(void);
extern void ets_wdt_disable(void);
// Converts bit of a string into a uint32
#define S(a,b,c,d) ( (((uint32_t)a) & 0xff) | (((uint32_t)b) << 8) | (((uint32_t)c) << 16) | (((uint32_t)d)<<24) )
int print_version(const uint32_t flash_addr)
{
uint32_t ver;
if (SPIRead(flash_addr + APP_START_OFFSET + sizeof(image_header_t) + sizeof(section_header_t), &ver, sizeof(ver))) {
return 1;
}
char fmt[7];
fmt[0] = 'v';
fmt[1] = '%';
fmt[2] = '0';
fmt[3] = '8';
fmt[4] = 'x';
fmt[5] = '\n';
fmt[6] = 0;
// We don't have BSS and can't print from flash, so build up string
// 4 chars at a time. Smaller code than byte-wise assignment.
uint32_t fmt[2];
fmt[0] = S('v', '%', '0', '8');
fmt[1] = S('x', '\n', 0, 0);
ets_printf((const char*) fmt, ver);
return 0;
}
@ -234,26 +234,32 @@ int main()
}
if (cmd.action == ACTION_COPY_RAW) {
ets_putc('c'); ets_putc('p'); ets_putc(':');
uint32_t cp = S('c', 'p', ':', 0);
ets_printf((const char *)cp);
ets_wdt_disable();
res = copy_raw(cmd.args[0], cmd.args[1], cmd.args[2], false);
ets_wdt_enable();
ets_putc('0'+res); ets_putc('\n');
cp = S('0' + res, '\n', 0, 0 );
ets_printf((const char *)cp);
#if 0
//devyte: this verify step below (cmp:) only works when the end of copy operation above does not overwrite the
//beginning of the image in the empty area, see #7458. Disabling for now.
//TODO: replace the below verify with hash type, crc, or similar.
// Verify the copy
ets_putc('c'); ets_putc('m'); ets_putc('p'); ets_putc(':');
uint32_t v[2];
v[0] = S('c', 'm', 'p', ':');
v[1] = 0;
ets_printf(const char *)v);
if (res == 0) {
ets_wdt_disable();
res = copy_raw(cmd.args[0], cmd.args[1], cmd.args[2], true);
ets_wdt_enable();
}
ets_putc('0'+res); ets_putc('\n');
cp = S('0' + res, '\n', 0, 0 );
ets_printf((const char *)cp);
#endif
if (res == 0) {
cmd.action = ACTION_LOAD_APP;
@ -268,8 +274,11 @@ int main()
if (cmd.action == ACTION_LOAD_APP) {
ets_putc('l'); ets_putc('d'); ets_putc('\n');
res = load_app_from_flash_raw(cmd.args[0]);
//we will get to this only on load fail
ets_putc('e'); ets_putc(':'); ets_putc('0'+res); ets_putc('\n');
// We will get to this only on load fail
uint32_t e[2];
e[0] = S('e', ':', '0' + res, '\n' );
e[1] = 0;
ets_printf((const char*)e);
}
if (res) {

Binary file not shown.

View File

@ -1,3 +1,20 @@
/*
Schedule.cpp - Scheduled functions.
Copyright (c) 2020 esp8266/Arduino
This file is part of the esp8266 core for Arduino environment.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
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 <assert.h>

View File

@ -1,3 +1,21 @@
/*
Schedule.h - Header file for scheduled functions.
Copyright (c) 2020 esp8266/Arduino
This file is part of the esp8266 core for Arduino environment.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
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
*/
#ifndef ESP_SCHEDULE_H
#define ESP_SCHEDULE_H

View File

@ -72,17 +72,22 @@ void EEPROMClass::begin(size_t size) {
_dirty = false; //make sure dirty is cleared in case begin() is called 2nd+ time
}
void EEPROMClass::end() {
if (!_size)
return;
bool EEPROMClass::end() {
bool retval;
commit();
if(!_size) {
return false;
}
retval = commit();
if(_data) {
delete[] _data;
}
_data = 0;
_size = 0;
_dirty = false;
return retval;
}

View File

@ -35,7 +35,7 @@ public:
uint8_t read(int const address);
void write(int const address, uint8_t const val);
bool commit();
void end();
bool end();
uint8_t * getDataPtr();
uint8_t const * getConstDataPtr() const;

View File

@ -254,7 +254,7 @@ void ESP8266WiFiGenericClass::_eventCallback(void* arg)
* Return the current channel associated with the network
* @return channel (1-13)
*/
int32_t ESP8266WiFiGenericClass::channel(void) {
uint8_t ESP8266WiFiGenericClass::channel(void) {
return wifi_get_channel();
}

View File

@ -74,7 +74,7 @@ class ESP8266WiFiGenericClass {
WiFiEventHandler onSoftAPModeProbeRequestReceived(std::function<void(const WiFiEventSoftAPModeProbeRequestReceived&)>);
WiFiEventHandler onWiFiModeChange(std::function<void(const WiFiEventModeChange&)>);
int32_t channel(void);
uint8_t channel(void);
bool setSleepMode(WiFiSleepType_t type, uint8_t listenInterval = 0);

View File

@ -686,7 +686,7 @@ String ESP8266WiFiSTAClass::BSSIDstr(void) {
* Return the current network RSSI.
* @return RSSI value
*/
int32_t ESP8266WiFiSTAClass::RSSI(void) {
int8_t ESP8266WiFiSTAClass::RSSI(void) {
return wifi_station_get_rssi();
}

View File

@ -81,7 +81,7 @@ class ESP8266WiFiSTAClass {
uint8_t * BSSID();
String BSSIDstr();
int32_t RSSI();
int8_t RSSI();
static void enableInsecureWEP (bool enable = true) { _useInsecureWEP = enable; }

View File

@ -6,4 +6,4 @@ sentence=tcpdump-like logger for esp8266/Arduino
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.
category=Communication
url=https://
architectures=esp8266 lwip
architectures=esp8266