Skip to content

Commit bf96e26

Browse files
committed
Merge branch 'master' of github.com:/tschak909/platotermzx
2 parents ccb29a4 + b63e387 commit bf96e26

File tree

3 files changed

+42
-8
lines changed

3 files changed

+42
-8
lines changed

src/include/uno/zifi.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#define FMODE_CREATE 0x0E
2323

2424
extern char* ssid;
25+
extern char* pass;
2526
extern char is_connected;
2627

2728
void initWifi();

src/spectrum/main.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,11 @@ void main(void)
5151
connect();
5252
#endif
5353
io_init();
54+
55+
#ifndef NO_BIT
5456
bit_play("2A--"); //Ready beep
55-
57+
#endif
58+
5659
for (;;)
5760
{
5861
for(int Kscan=0;Kscan<20;Kscan++) //Keyboard scanning loop

src/spectrum/uno/zifi.c

Lines changed: 37 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
#include <conio.h>
44
#include "../../include/uno/zifi.h"
5+
#include "../../include/help.h"
56
int is_connected = 0;
67

78
void initWifi()
@@ -11,6 +12,18 @@ void initWifi()
1112
__endasm;
1213
}
1314

15+
void noWiFiConfigCheck()
16+
{
17+
if (&ssid[0] == 0) {
18+
help_clear();
19+
cprintf("Enter ssid: ");
20+
cgets(&ssid);
21+
help_clear();
22+
cprintf("Enter password:");
23+
cgets(&pass);
24+
help_clear();
25+
}
26+
}
1427

1528
void errInit()
1629
{
@@ -339,6 +352,23 @@ __asm
339352
call uartBegin
340353
call loadWiFiConfig
341354

355+
ld hl, cmd_plus
356+
call uartWriteStringZ
357+
halt
358+
halt
359+
halt
360+
ld hl, cmd_rst
361+
call uartWriteStringZ
362+
363+
rstLp:
364+
call uartReadBlocking
365+
call pushRing
366+
367+
ld hl, response_rdy
368+
call searchRing
369+
cp 1
370+
jr nz, rstLp
371+
342372
ld hl, cmd_at ; Disable ECHO. BTW Basic UART test
343373
call okErrCmd
344374
and 1
@@ -450,9 +480,10 @@ __asm
450480
ld hl, _pass
451481
ld bc, 80
452482
call fread
453-
pop af
454-
483+
pop af
455484
call fclose
485+
486+
jp _noWiFiConfigCheck
456487
ret
457488

458489
; Pushes A to ring buffer
@@ -514,7 +545,9 @@ __asm
514545

515546
ring_buffer: defs 32
516547

517-
cmd_at: defb 'A', 'T', 'E', '0', 13, 10, 0 ; Disable echo - less to parse
548+
cmd_plus: defb "+++", 0
549+
cmd_rst: defb "AT+RST\r\n", 0
550+
cmd_at: defb "ATE0\r\n", 0 ; Disable echo - less to parse
518551
cmd_mode: defb "AT+CWMODE_DEF=1\r\n",0 ; Client mode
519552
cmd_cmux: defb "AT+CIPMUX=0\r\n",0 ; Single connection mode
520553
cmd_cwqap: defb "AT+CWQAP\r\n",0 ; Disconnect from AP
@@ -531,17 +564,14 @@ cmd_open1: defb "AT+CIPSTART=\"TCP\",\"", 0
531564
cmd_open2: defb "\",", 0
532565
cmd_open3: defb "\r\n", 0
533566

567+
response_rdy: defb "ready\r\n",0
534568
response_ok: defb "OK",13, 10, 0 ; Sucessful operation
535569
response_err: defb "ERROR",13,10,0 ; Failed operation
536570
response_fail: defb "FAIL",13,10,0 ; Failed connection to WiFi. For us same as ERROR
537571

538572
_ssid: defs 80
539573
_pass: defs 80
540574

541-
_bytes_avail: defw 0
542-
sbyte_buff: defb 0, 0
543-
_output_buffer: defs 2048 ;ESP sends not more 1460 bytes, but better have some spaces
544-
545575
send_prompt: defb ">",0
546576

547577
; WiFi configuration

0 commit comments

Comments
 (0)