A place users can post their projects. If you have a small project and would like your own dedicated place to post and have others chat about it then this is your spot.

User avatar
By alonewolfx2
#2922
Borstenhorst wrote:from where you doing this?

user_main.c
User avatar
By Borstenhorst
#2925 I present: the worst hack ever :P

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);
}
User avatar
By alonewolfx2
#2930 its working. And you are awesome :D :)

Borstenhorst wrote:I present: the worst hack ever :P
User avatar
By alonewolfx2
#2931 One more question :) i try this and i am getting DNS Fail/r/n
Code: Select allvoid auto_setup_elapsed()
{
   char temp[128];
   os_sprintf(temp,"=\"TCP\",\"192.168.2.69/new_value.php?d=5&o=4\",80");
   
   //at_setupCmdCipStartLog(19,temp);
at_setupCmdCipstart(12,temp);
   }


Borstenhorst wrote:I present: the worst hack ever :P