1
- /*
1
+ /*
2
2
Esp.cpp - ESP8266-specific APIs
3
3
Copyright (c) 2015 Ivan Grokhotkov. All rights reserved.
4
4
This file is part of the esp8266 core for Arduino environment.
5
-
5
+
6
6
This library is free software; you can redistribute it and/or
7
7
modify it under the terms of the GNU Lesser General Public
8
8
License as published by the Free Software Foundation; either
@@ -32,7 +32,7 @@ extern struct rst_info resetInfo;
32
32
33
33
// #define DEBUG_SERIAL Serial
34
34
35
-
35
+
36
36
/* *
37
37
* User-defined Literals
38
38
* usage:
@@ -92,7 +92,7 @@ void EspClass::wdtEnable(WDTO_t timeout_ms)
92
92
93
93
void EspClass::wdtDisable (void )
94
94
{
95
- // / Please don’ t stop software watchdog too long (less than 6 seconds),
95
+ // / Please don' t stop software watchdog too long (less than 6 seconds),
96
96
// / otherwise it will trigger hardware watchdog reset.
97
97
system_soft_wdt_stop ();
98
98
}
@@ -102,13 +102,15 @@ void EspClass::wdtFeed(void)
102
102
103
103
}
104
104
105
+ extern " C" void esp_yield ();
106
+
105
107
void EspClass::deepSleep (uint32_t time_us, WakeMode mode)
106
108
{
107
- system_deep_sleep_set_option (static_cast <int >(mode));
108
- system_deep_sleep (time_us);
109
+ system_deep_sleep_set_option (static_cast <int >(mode));
110
+ system_deep_sleep (time_us);
111
+ esp_yield ();
109
112
}
110
113
111
- extern " C" void esp_yield ();
112
114
extern " C" void __real_system_restart_local ();
113
115
void EspClass::reset (void )
114
116
{
@@ -119,9 +121,6 @@ void EspClass::restart(void)
119
121
{
120
122
system_restart ();
121
123
esp_yield ();
122
- // todo: provide an alternative code path if this was called
123
- // from system context, not from continuation
124
- // (implement esp_is_cont_ctx()?)
125
124
}
126
125
127
126
uint16_t EspClass::getVcc (void )
@@ -333,7 +332,7 @@ uint32_t EspClass::getSketchSize() {
333
332
DEBUG_SERIAL.printf (" num_segments=%u\r\n " , image_header.num_segments );
334
333
#endif
335
334
for (uint32_t section_index = 0 ;
336
- section_index < image_header.num_segments ;
335
+ section_index < image_header.num_segments ;
337
336
++section_index)
338
337
{
339
338
section_header_t section_header = {0 };
@@ -395,8 +394,7 @@ bool EspClass::updateSketch(Stream& in, uint32_t size, bool restartOnFail, bool
395
394
396
395
#ifdef DEBUG_SERIAL
397
396
DEBUG_SERIAL.println (" Update SUCCESS" );
398
- #endif
397
+ #endif
399
398
if (restartOnSuccess) ESP.restart ();
400
399
return true ;
401
400
}
402
-
0 commit comments