Chat freely about anything...

User avatar
By MertG
#27886 I created a sample application based on blinky examples. You can check the code below. Uploaded the code to esp12 an saw it working fine. But when i checked uart output:

esp_debug_01.PNG
Uart Output
esp_debug_01.PNG (6.25 KiB) Viewed 1766 times


i see that the device also works as a SOFT_AP and i also can see the wifi network with my cellphone. I did not want this behaviour and did not write code about it. Is this normal? How can I turn off this behaviour?

Code: Select all#include "ets_sys.h"
#include "osapi.h"
#include "os_type.h"
#include "gpio.h"

// see eagle_soc.h for these definitions
#define LED_PIN 4
#define LED_GPIO_MUX PERIPHS_IO_MUX_GPIO4_U
#define LED_GPIO_FUNC FUNC_GPIO4

#define DELAY 500 /* milliseconds */

LOCAL os_timer_t blink_timer;
LOCAL uint8_t led_state=0;

LOCAL void ICACHE_FLASH_ATTR blink_cb(void *arg)
{
   GPIO_OUTPUT_SET(LED_PIN, led_state);
   led_state ^=1;
   //os_printf("...Beat...\n");
}

void user_rf_pre_init(void)
{
}

void user_init(void)
{
    gpio_init();
    //os_printf("SDK version: %s \n", system_get_sdk_version());

   // Configure pin as a GPIO
   PIN_FUNC_SELECT(LED_GPIO_MUX, LED_GPIO_FUNC);
   // Set up a timer to blink the LED
   // os_timer_disarm(ETSTimer *ptimer)
   os_timer_disarm(&blink_timer);
   // os_timer_setfn(ETSTimer *ptimer, ETSTimerFunc *pfunction, void *parg)
   os_timer_setfn(&blink_timer, (os_timer_func_t *)blink_cb, (void *)0);
   // void os_timer_arm(ETSTimer *ptimer,uint32_t milliseconds, bool repeat_flag)
   os_timer_arm(&blink_timer, DELAY, 1);
}
User avatar
By MertG
#29007 After doing some reading (also thanks to Kolban's Book) I've learned that esp saves wifi settings in the flash and if you dont do anything to alter, in every boot, it loads settings and commit what they say. So in my case esp is configured with "factory default" SOFT_AP and simply does what it says.

Thanks.