Hi,

I have the following scenario where I read some configuration from a config file stored in the WIFI_FILE_SYSTEM.

When the configuration is read I configure the WLAN_Setup and finally call:

 WLAN_Enable();

this call blocks until it times out or the WIFI connection is successful.

Now I want to be able to delete & reset the configuration saved on the WIFI_FILE_SYSTEM. For this I implemented buton with callback:

/*Callback for Button 2 */
void button2Callback(uint32_t data)
{
    Retcode_T returnValue = CmdProcessor_EnqueueFromIsr(AppCmdProcessor, processbuttonCallback2, NULL, data);
    if (RETCODE_OK != returnValue)
    {
        printf("MQTTButton: Enqueuing for Button 2 callback failed [%lu]\n\r", returnValue);
    }
}

But every time I press button 2 while WLAN_Enable() still blocks I get:

 

INFO | XDK DEVICE 1: WLAN_Enable : Preparing for Personal WPA2 connection
 INFO | XDK DEVICE 1: This is a CC3100R device
 INFO | XDK DEVICE 1: CHIP 0x4000000
 INFO | XDK DEVICE 1: MAC 99.1.2.0.2
 INFO | XDK DEVICE 1: PHY 1.0.3.23
 INFO | XDK DEVICE 1: NWP 2.2.0.1
 INFO | XDK DEVICE 1: ROM 0x3333
 INFO | XDK DEVICE 1: HOST 1.0.1.11
 INFO | XDK DEVICE 1: MQTTButton: Enqueuing for Button 2 callback failed [34545665]

How can I implement my callback?

 

Regards Christof

0 (0 Voti)
RE: Button callback fails when WLAN-Enable() is started
Risposta
25/09/19 6.27 come risposta a Christof Strack.

Hi,

I found a solution. Instead of listening to a button event I use the function BSP_Button_GetState and test right at startup of the XDK if a button was pressed:

	if (BSP_Button_GetState((uint32_t) BSP_XDK_BUTTON_2) == 1) {
		printf("AppController_Setup: Button 2 was pressed at startup and delete config stored on wifi chip!\r\n");
		MQTTFlash_FLDeleteConfig();
		BSP_Board_SoftReset();
	}

This way I can reliablly reset the configuration.

 

--Christof

+1 (1 Voto)