Skip to content

Commit aec8b6b

Browse files
authored
Merge pull request #82 from WKJay/master
[FIX] wifi ssid and password config problem
2 parents 11df452 + 7aa6fcd commit aec8b6b

File tree

17 files changed

+306
-594
lines changed

17 files changed

+306
-594
lines changed

projects/art_pi_factory/.cproject

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

projects/art_pi_factory/.settings/projcfg.ini

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#RT-Thread Studio Project Configuration
2-
#Thu Oct 01 00:08:57 CST 2020
2+
#Wed Oct 21 22:04:18 CST 2020
33
cfg_version=v3.0
44
board_name=STM32H750-RT-ART-PI
55
example_name=art_pi_factory
@@ -13,7 +13,7 @@ os_branch=full
1313
project_base_bsp=true
1414
is_use_scons_build=True
1515
is_base_example_project=True
16-
output_project_path=C\:/Projects/ART-PI/sdk-bsp-stm32h750-realthread-artpimy/projects
16+
output_project_path=E\:/Personal/RTT-Studio-Projects/sdk-bsp-stm32h750-realthread-artpimy/projects
1717
project_name=art_pi_factory
1818
bsp_path=repo/Local/Board_Support_Packages/RealThread/STM32H750-RT-ART-PI/0.3.0/sdk-bsp-stm32h750-realthread-artpi-master
1919
os_version=4.0.2

projects/art_pi_factory/applications/main.c

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,7 @@ int main(void)
3333
sys_monitor_init();
3434
web_init();
3535
bluetooth_init();
36-
37-
38-
while (1)
39-
{
40-
rt_thread_mdelay(1000);
41-
42-
}
36+
4337
return RT_EOK;
4438
}
4539

projects/art_pi_factory/modules/basic/basic.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ Author: WKJay
2929

3030
#define BLUE_LED GET_PIN(I, 8)
3131
#define RED_LED GET_PIN(C, 15)
32-
static uint8_t blue_led_stat = 0, red_led_stat = 0, beep_stat = 0;
32+
static uint8_t blue_led_stat = 0, red_led_stat = 0;
3333

3434
static char *board_control(const char *dev, uint8_t code)
3535
{
@@ -43,11 +43,6 @@ static char *board_control(const char *dev, uint8_t code)
4343
rt_pin_write(RED_LED, !code);
4444
red_led_stat = code;
4545
}
46-
else if (strcmp(dev, BEEP_DEV_NAME) == 0)
47-
{
48-
//beep control
49-
beep_stat = code;
50-
}
5146
else
5247
{
5348
return json_create_web_response(-1, "unknown control device!");
@@ -159,6 +154,7 @@ static char *json_create_basic_info(void)
159154
static void cgi_basic_info(struct webnet_session *session)
160155
{
161156
cgi_head();
157+
request = request;//clear warning
162158
body = json_create_basic_info();
163159
webnet_session_printf(session, body);
164160
rt_free(body);
@@ -167,6 +163,7 @@ static void cgi_basic_info(struct webnet_session *session)
167163
static void cgi_board_control(struct webnet_session *session)
168164
{
169165
cgi_head();
166+
request = request;//clear warning
170167
if (session->request->query)
171168
{
172169
cJSON *root = cJSON_Parse(session->request->query);

projects/art_pi_factory/modules/bt_module/bt_module.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@ int bluetooth_firmware_check(void)
6767

6868
int bluetooth_init(void)
6969
{
70-
int fd = -1;
7170
rt_device_t wifi = NULL, bt_firmware = NULL;
7271
//wait for wifi is ready
7372
while (wifi == NULL)

projects/art_pi_factory/modules/monitor/monitor.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ static void ntp_sync_handler(void)
6161
}
6262
}
6363

64-
static void sys_monitor_thread(void)
64+
static void sys_monitor_thread(void *param)
6565
{
6666
while (1)
6767
{

projects/art_pi_factory/modules/wifi/wifi.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ int wifi_connect(char *conn_str)
4444
{
4545
cJSON *ssid = cJSON_GetObjectItem(conn, "ssid");
4646
cJSON *passwd = cJSON_GetObjectItem(conn, "passwd");
47+
rt_memset(wifi.ssid,0,sizeof(wifi.ssid));
48+
rt_memset(wifi.passwd,0,sizeof(wifi.passwd));
4749
if (ssid && passwd)
4850
{
4951
if (rt_strlen(ssid->valuestring) > MAX_SSID_PASSWD_STR_LEN ||
@@ -92,26 +94,26 @@ char *wifi_get_ip(void)
9294

9395
char *wifi_status_get(void)
9496
{
95-
memset(wifi_status_str, 0, sizeof(wifi_status_str));
97+
rt_memset(wifi_status_str, 0, sizeof(wifi_status_str));
9698
uint8_t wifi_status = wifi_is_ready();
9799
char *wifi_ip = wifi_get_ip();
98-
sprintf(wifi_status_str, "{wifi:'%s', url:'%s'}", wifi_status ? "on" : "off", wifi_ip);
100+
rt_sprintf(wifi_status_str, "{wifi:'%s', url:'%s'}", wifi_status ? "on" : "off", wifi_ip);
99101
return wifi_status_str;
100102
}
101103

102-
static void wifi_ready_handler(void *param)
104+
static void wifi_ready_handler(int event, struct rt_wlan_buff *buff, void *parameter)
103105
{
104106
int cnt = BT_SEND_TIMES;
105107
//adb init
106108
adb_socket_init();
107109

108110
//wifi status send
109-
memset(wifi_status_str, 0, sizeof(wifi_status_str));
111+
rt_memset(wifi_status_str, 0, sizeof(wifi_status_str));
110112
while (cnt--)
111113
{
112114
char *wifi_status = wifi_status_get();
113115
int retry_cnt = BT_SEND_FAIL_RETRY;
114-
while (bt_stack_blufi_send(wifi_status, strlen(wifi_status)) < 0)
116+
while (bt_stack_blufi_send((uint8_t *)wifi_status, rt_strlen(wifi_status)) < 0)
115117
{
116118
if (retry_cnt == 0)
117119
break;

projects/art_pi_factory/packages/btstack-v0.0.1/SConscript

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,10 @@ path += [cwd + '/chipset/bcm']
5656
path += [cwd + '/port/posix-h4-bcm']
5757
path += [cwd + '/rtt_adapter']
5858

59-
group = DefineGroup('RTT_BTSTACK', src, depend = [''], CPPPATH = path)
59+
LOCAL_CCFLAGS = ''
60+
if rtconfig.CROSS_TOOL == 'keil':
61+
LOCAL_CCFLAGS += ' --gnu'
62+
63+
group = DefineGroup('RTT_BTSTACK', src, depend = [''], CPPPATH = path, LOCAL_CCFLAGS = LOCAL_CCFLAGS)
6064

6165
Return('group')

projects/art_pi_factory/packages/btstack-v0.0.1/chipset/bcm/btstack_chipset_bcm.c

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ static void chipset_set_bd_addr_command(bd_addr_t addr, uint8_t *hci_cmd_buffer)
110110
static const char * hcd_file_path;
111111
static const char * hcd_folder_path = "";
112112
static int hcd_fd;
113-
static char matched_file[1000];
113+
//static char matched_file[1000];
114114

115115

116116
static void chipset_init(const void * config){
@@ -127,9 +127,9 @@ static void chipset_init(const void * config){
127127
static const uint8_t download_command[] = {0x2e, 0xfc, 0x00};
128128

129129
static btstack_chipset_result_t chipset_next_command(uint8_t * hci_cmd_buffer){
130-
static hcd_file_length;
130+
static int hcd_file_length;
131131
if (hcd_fd < 0){
132-
fal_partition_t *hcd_part = fal_partition_find("bt_image");
132+
const struct fal_partition *hcd_part = fal_partition_find("bt_image");
133133
log_info("chipset-bcm: hcd_file_path open file %s", hcd_file_path);
134134
hcd_fd = open(hcd_file_path, O_RDONLY);
135135
if (hcd_fd < 0){
@@ -187,16 +187,16 @@ void btstack_chipset_bcm_set_hcd_folder_path(const char * path){
187187
hcd_folder_path = path;
188188
}
189189

190-
static int equal_ignore_case(const char *str1, const char *str2){
191-
if (!str1 || !str2) return (1);
192-
int i = 0;
193-
while (true){
194-
if (!str1[i] && !str2[i]) return 1;
195-
if (tolower(str1[i]) != tolower(str2[i])) return 0;
196-
if (!str1[i] || !str2[i]) return 0;
197-
i++;
198-
}
199-
}
190+
//static int equal_ignore_case(const char *str1, const char *str2){
191+
// if (!str1 || !str2) return (1);
192+
// int i = 0;
193+
// while (true){
194+
// if (!str1[i] && !str2[i]) return 1;
195+
// if (tolower(str1[i]) != tolower(str2[i])) return 0;
196+
// if (!str1[i] || !str2[i]) return 0;
197+
// i++;
198+
// }
199+
//}
200200

201201
// assumption starts with BCM or bcm
202202
#define MAX_DEVICE_NAME_LEN 25

projects/art_pi_factory/packages/btstack-v0.0.1/platform/posix/btstack_run_loop_posix.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,12 @@
5353
#include "btstack_linked_list.h"
5454
#include "btstack_debug.h"
5555

56+
#include <rtthread.h>
5657
#include <stdio.h>
5758
#include <stdlib.h>
58-
#include <sys/select.h>
5959
#include <sys/time.h>
6060
#include <time.h>
61+
#include <sys/select.h>
6162
#include <unistd.h>
6263

6364
static void btstack_run_loop_posix_dump_timer(void);
@@ -123,10 +124,11 @@ static bool btstack_run_loop_posix_remove_timer(btstack_timer_source_t *ts){
123124

124125
static void btstack_run_loop_posix_dump_timer(void){
125126
btstack_linked_item_t *it;
126-
int i = 0;
127127
for (it = (btstack_linked_item_t *) timers; it ; it = it->next){
128+
#ifdef ENABLE_LOG_INFO
128129
btstack_timer_source_t *ts = (btstack_timer_source_t*) it;
129130
log_info("timer %u (%p): timeout %u\n", i, ts, ts->timeout);
131+
#endif
130132
}
131133
}
132134

@@ -184,9 +186,7 @@ static uint32_t btstack_run_loop_posix_get_time_ms(void){
184186
clock_gettime(CLOCK_MONOTONIC, &now_ts);
185187
time_ms = (uint32_t) timespec_diff_milis(&init_ts, &now_ts);
186188
#else
187-
struct timeval tv;
188-
gettimeofday(&tv, NULL);
189-
time_ms = (uint32_t) ((tv.tv_sec - init_tv.tv_sec) * 1000) + (tv.tv_usec / 1000);
189+
time_ms = rt_tick_get()*1000ULL/RT_TICK_PER_SECOND;
190190
#endif
191191
return time_ms;
192192
}

0 commit comments

Comments
 (0)