@@ -49,7 +49,6 @@ extern "C" {
49
49
#include " lwip/netif.h"
50
50
#include " dhcpserver/dhcpserver.h"
51
51
#include " dhcpserver/dhcpserver_options.h"
52
-
53
52
} // extern "C"
54
53
55
54
#include " esp32-hal.h"
@@ -241,10 +240,10 @@ extern "C" void phy_bbpll_en_usb(bool en);
241
240
242
241
#if CONFIG_ESP_WIFI_REMOTE_ENABLED
243
242
extern " C" {
244
- // #include "esp_hosted.h"
245
- #include " esp_hosted_transport_config.h"
246
- extern esp_err_t esp_hosted_init ();
247
- extern esp_err_t esp_hosted_deinit ();
243
+ #include " esp_hosted.h"
244
+ // #include "esp_hosted_transport_config.h"
245
+ // extern esp_err_t esp_hosted_init();
246
+ // extern esp_err_t esp_hosted_deinit();
248
247
};
249
248
typedef struct {
250
249
uint8_t pin_clk;
@@ -296,6 +295,15 @@ bool WiFiGenericClass::setPins(int8_t clk, int8_t cmd, int8_t d0, int8_t d1, int
296
295
return true ;
297
296
}
298
297
298
+ bool WiFiGenericClass::updateSlave (const char * url) {
299
+ esp_err_t err = esp_hosted_slave_ota (url);
300
+ if (err != ESP_OK) {
301
+ log_e (" esp_hosted_slave_ota failed! 0x%x: %s" , err, esp_err_to_name (err));
302
+ return false ;
303
+ }
304
+ return true ;
305
+ }
306
+
299
307
static bool wifiHostedInit () {
300
308
if (!hosted_initialized) {
301
309
hosted_initialized = true ;
@@ -314,6 +322,11 @@ static bool wifiHostedInit() {
314
322
return false ;
315
323
}
316
324
log_v (" ESP-HOSTED initialized!" );
325
+ // // This throws heap exception when the slave has older firmware
326
+ // esp_hosted_coprocessor_fwver_t fwver = {0,0,0};
327
+ // if (esp_hosted_get_coprocessor_fwversion(&fwver) == ESP_OK) {
328
+ // log_d("ESP-HOSTED Slave FW Version: %lu.%li.%lu", fwver.major1, fwver.minor1, fwver.patch1);
329
+ // }
317
330
}
318
331
// Attach pins to PeriMan here
319
332
// Slave chip model is CONFIG_IDF_SLAVE_TARGET
0 commit comments