frame

esp8266 Access Point Mode

andris Birza Member
edited February 4 in Libraries & Drivers
Hi,

I tried using Zerynth with esp module. Problem that I have is that driver for WiFi doesn't support AP or AP+STA mode, is there any plans to implement this functionality?
I have tried to write my own C functions that call functions from "esp8266/esp8266wifi.h" to setup and enable AP mode. It compiles fine, bet when I try to upload code to module I get error: 
[info] Handshake
[info]     symbols: 215
[info]     membase  @3FFF5188
[info]     romstart @40270000
[info]     flash    @00090000
[error] There are 2 missing symbols! This VM does not support the requested features!

Is there any guide available how I could enable AP mode?

code that I used to call setup function
#define ZERYNTH_PRINTF

#include "zerynth.h"
#include "esp8266/esp8266.h"
#include "esp8266/esp8266wifi.h"
#include "lwip/netif.h"
#include "lwip/dns.h"
#include "lwip/sockets.h"

C_NATIVE(display_mode)
{
C_NATIVE_UNWARN();

WIFI_MODE mode = wifi_get_opmode();
printf("Current mode: %d\n", mode);

*res = MAKE_NONE();
return ERR_OK;
}


C_NATIVE(enable_ap)
{
C_NATIVE_UNWARN();

const char *ssid = "NodeMCU";

if(!wifi_set_opmode(SOFTAP_MODE))
{
printf("Failed to enable AP Mode\n");
}

struct softap_config conf;
conf.ssid[0] = 'n';
conf.ssid[1] = 'o';
conf.ssid[2] = 'd';
conf.ssid[3] = 'e';
conf.channel = 1;
conf.ssid_len = 4;
conf.ssid_hidden = 0;
conf.max_connection = 4;
conf.beacon_interval = 100;
conf.authmode = AUTH_OPEN;
*conf.password = 0;

if(!wifi_softap_set_config(&conf))
{
printf("Failed to setup config\n");
}


*res = MAKE_NONE();
return ERR_OK;
}

Comments

  • Hello @"andris Birza" ,

    AP and AP+STA are not supported at the moment, but both functionalities are going to be added soon.

    Your approach in C is correct, however a VM exporting all the required AP functions is needed for it to work.

    I'll keep you posted

    Giacomo Baldi
    Zerynth Head of Software Development
Sign In or Register to comment.

ZERYNTH Community

@ 2016 Zerynth.com, all rights reserved.