reset ota module on every vm run

This commit is contained in:
microDev 2020-12-10 16:48:58 +05:30
parent 07015ad527
commit 6a4f74946f
No known key found for this signature in database
GPG Key ID: 2C0867BE60967730
3 changed files with 10 additions and 4 deletions

View File

@ -24,6 +24,7 @@
* THE SOFTWARE. * THE SOFTWARE.
*/ */
#include "common-hal/ota/__init__.h"
#include "shared-bindings/ota/__init__.h" #include "shared-bindings/ota/__init__.h"
#include <string.h> #include <string.h>
@ -37,7 +38,7 @@ static esp_ota_handle_t update_handle = 0;
static bool ota_inited = false; static bool ota_inited = false;
static const char *TAG = "OTA"; static const char *TAG = "OTA";
static void ota_reset(void) { void ota_reset(void) {
update_handle = 0; update_handle = 0;
update_partition = NULL; update_partition = NULL;
ota_inited = false; ota_inited = false;

View File

@ -24,9 +24,9 @@
* THE SOFTWARE. * THE SOFTWARE.
*/ */
#ifndef MICROPY_INCLUDED_ESP32S2_COMMON_HAL_OTA__INIT__H #ifndef MICROPY_INCLUDED_ESP32S2_COMMON_HAL_OTA___INIT___H
#define MICROPY_INCLUDED_ESP32S2_COMMON_HAL_OTA__INIT__H #define MICROPY_INCLUDED_ESP32S2_COMMON_HAL_OTA___INIT___H
extern void ota_reset(void); extern void ota_reset(void);
#endif //MICROPY_INCLUDED_ESP32S2_COMMON_HAL_OTA__INIT__H #endif //MICROPY_INCLUDED_ESP32S2_COMMON_HAL_OTA___INIT___H

View File

@ -41,6 +41,7 @@
#include "common-hal/busio/I2C.h" #include "common-hal/busio/I2C.h"
#include "common-hal/busio/SPI.h" #include "common-hal/busio/SPI.h"
#include "common-hal/busio/UART.h" #include "common-hal/busio/UART.h"
#include "common-hal/ota/__init__.h"
#include "common-hal/ps2io/Ps2.h" #include "common-hal/ps2io/Ps2.h"
#include "common-hal/pulseio/PulseIn.h" #include "common-hal/pulseio/PulseIn.h"
#include "common-hal/pwmio/PWMOut.h" #include "common-hal/pwmio/PWMOut.h"
@ -107,6 +108,10 @@ void reset_port(void) {
analogout_reset(); analogout_reset();
#endif #endif
#if CIRCUITPY_OTA
ota_reset();
#endif
#if CIRCUITPY_PS2IO #if CIRCUITPY_PS2IO
ps2_reset(); ps2_reset();
#endif #endif