<commit_before>//////////////////////////////////////////////////
// rBoot sample project.
// Copyright 2015 <NAME>
// <EMAIL>
// See license.txt for license terms.
//////////////////////////////////////////////////

#include <osapi.h>
#include <user_interface.h>
#include <time.h>
#include <mem.h>

#include "main.h"
#include "user_config.h"
#include "rboot-ota.h"
#include "uart.h"

static os_timer_t network_timer;

void ICACHE_FLASH_ATTR user_rf_pre_init() {
}

void ICACHE_FLASH_ATTR network_wait_for_ip() {

	struct ip_info ipconfig;
	os_timer_disarm(&network_timer);
	wifi_get_ip_info(STATION_IF, &ipconfig);
	if (wifi_station_get_connect_status() == STATION_GOT_IP && ipconfig.ip.addr != 0) {
		char page_buffer[40];
		os_sprintf(page_buffer,"ip: %d.%d.%d.%d\r\n",IP2STR(&ipconfig.ip));
		uart0_send(page_buffer);
	} else {
		char page_buffer[40];
		os_sprintf(page_buffer,"network retry, status: %d\r\n",wifi_station_get_connect_status());
		if(wifi_station_get_connect_status() == 3) wifi_station_connect();
		uart0_send(page_buffer);
		os_timer_setfn(&network_timer, (os_timer_func_t *)network_wait_for_ip, NULL);
		os_timer_arm(&network_timer, 2000, 0);
	}
}

void ICACHE_FLASH_ATTR wifi_config_station() {

	struct station_config stationConf;

	wifi_set_opmode(0x1);
	stationConf.bssid_set = 0;
	os_strncpy((char*)&stationConf.ssid, WIFI_SSID, os_strlen(WIFI_SSID));
	os_strncpy((char*)&stationConf.password, WIFI_PWD, os_strlen(WIFI_PWD));
	wifi_station_set_config(&stationConf);
	uart0_send("wifi connecting...\r\n");
	wifi_station_connect();
	os_timer_disarm(&network_timer);
	os_timer_setfn(&network_timer, (os_timer_func_t *)network_wait_for_ip, NULL);
	os_timer_arm(&network_timer, 2000, 0);
}<commit_msg>fix strcpy bug<commit_after>//////////////////////////////////////////////////
// rBoot sample project.
// Copyright 2015 <NAME>
// <EMAIL>
// See license.txt for license terms.
//////////////////////////////////////////////////

#include <osapi.h>
#include <user_interface.h>
#include <time.h>
#include <mem.h>

#include "main.h"
#include "user_config.h"
#include "rboot-ota.h"
#include "uart.h"

static os_timer_t network_timer;

void ICACHE_FLASH_ATTR user_rf_pre_init() {
}

void ICACHE_FLASH_ATTR network_wait_for_ip() {

	struct ip_info ipconfig;
	os_timer_disarm(&network_timer);
	wifi_get_ip_info(STATION_IF, &ipconfig);
	if (wifi_station_get_connect_status() == STATION_GOT_IP && ipconfig.ip.addr != 0) {
		char page_buffer[40];
		os_sprintf(page_buffer,"ip: %d.%d.%d.%d\r\n",IP2STR(&ipconfig.ip));
		uart0_send(page_buffer);
	} else {
		char page_buffer[40];
		os_sprintf(page_buffer,"network retry, status: %d\r\n",wifi_station_get_connect_status());
		if(wifi_station_get_connect_status() == 3) wifi_station_connect();
		uart0_send(page_buffer);
		os_timer_setfn(&network_timer, (os_timer_func_t *)network_wait_for_ip, NULL);
		os_timer_arm(&network_timer, 2000, 0);
	}
}

void ICACHE_FLASH_ATTR wifi_config_station() {

	struct station_config stationConf;

	wifi_set_opmode(0x1);
	stationConf.bssid_set = 0;
	os_strcpy((char*)&stationConf.ssid, WIFI_SSID);
	os_strcpy((char*)&stationConf.password, WIFI_PWD);
	wifi_station_set_config(&stationConf);
	uart0_send("wifi connecting...\r\n");
	wifi_station_connect();
	os_timer_disarm(&network_timer);
	os_timer_setfn(&network_timer, (os_timer_func_t *)network_wait_for_ip, NULL);
	os_timer_arm(&network_timer, 2000, 0);
}
{'fraction_non_alphanumeric': 0.190951821386604, 'fraction_numerical': 0.015863689776733254, 'mean_word_length': 4.665557404326123, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6279167', 'n_tokens_mistral': 1354, 'n_tokens_neox': 1298, 'n_words': 198}