- Wed Nov 19, 2014 12:25 pm
#2925
I present: the worst hack ever

This is just a 5 minute hack, not a proper implementation but.... it works.
The code is based on assumptions about the structure, so its really just a hack. Please dont make me responsible for this :p
The idea is that after 2 seconds the system should be up. If you have slow wifi, make it a bit longer to make sure the connection is up at that point.
The proper implementation would be to have an event fired once the device is connected and then checks if there is autorun config available in the flash.
But as I was not able to find information about how to write own configurations to the flash during runtime this is a future feature.
at_port.c
add call to hardcoded_connect();
Code: Select allvoid ICACHE_FLASH_ATTR
at_init(void)
{
system_os_task(at_busyTask, at_busyTaskPrio, at_busyTaskQueue, at_busyTaskQueueLen);
system_os_task(at_procTask, at_procTaskPrio, at_procTaskQueue, at_procTaskQueueLen);
hardcoded_connect();
}
at_base_cmd.h
the new functions:
Code: Select allvoid hardcoded_connect();
void auto_setup_elapsed();
at_base_cmd.c
global timer
Code: Select allstatic volatile os_timer_t auto_setup;
and implementation, this is for a MUX=0
Code: Select allvoid hardcoded_connect()
{
os_timer_disarm(&auto_setup);
//Setup timer
os_timer_setfn(&auto_setup, (os_timer_func_t *)auto_setup_elapsed, NULL);
//Set up the timer, (timer, milliseconds, 1=cycle 0=once)
os_timer_arm(&auto_setup, 2000, 0);
}
void auto_setup_elapsed()
{
char temp[128];
os_sprintf(temp,"=\"TCP\",\"yourURL\",80");
at_setupCmdCipStartLog(19,temp);
}