Skip to content

Commit

Permalink
Добавлена справка по кнопке Menu.
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexey Presniakov committed Apr 7, 2018
1 parent 4f43917 commit a39fa8b
Show file tree
Hide file tree
Showing 18 changed files with 712 additions and 16 deletions.
Binary file added builds/21/0x00000.bin
Binary file not shown.
Binary file added builds/21/fota.bin
Binary file not shown.
1 change: 1 addition & 0 deletions doc/url.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
http://www.computer-museum.ru/technlgy/8bitproc.htm
https://github.com/pvvx/MinEspSDKLib
https://github.com/cnlohr/MinEspSDKLib
http://www.danbigras.ru/index.html
2 changes: 1 addition & 1 deletion soft/EmuAPP/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ C_SOURCES+= \
src/tape.c src/reboot.c \
src/crc8.c src/ffs.c \
src/files.c src/align4.c \
src/fileman.c
src/fileman.c src/help.c

##############################################################################

Expand Down
152 changes: 152 additions & 0 deletions soft/EmuAPP/src/help.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
#include "help.h"

#include "ets.h"
#include "vg75.h"
#include "ui.h"
#include "ps2.h"
#include "ps2_codes.h"


#define HELP_AT 0x50000


static int n_lines=-1, line=0;


static void display(void)
{
int addr=0;

// þÉÔÁÅÍ ÁÄÒÅÓ ÐÅÒ×ÏÊ ×ÉÄÉÍÏÊ ÓÔÒÏËÉ
if (line != 0)
{
uint16_t tmp[2];
SPIRead(HELP_AT+(line & 0xFFFE)*2, (uint32_t*)tmp, 4); // ÞÔÅÎÉÅ ÄÏÌÖÎÏ ÂÙÔØ ×ÙÒÁ×ÎÅÎÏ ÐÏ ÇÒÁÎÉÃÅ 4 ÂÁÊÔ
addr=tmp[line & 1];
}

// äÏÂÁ×ÌÑÅÍ ÓÍÅÝÅÎÉÅ ÔÁÂÌÉÃÙ ÓÔÒÏË É ÁÄÒÅÓ ÎÁÞÁÌÁ ×Ï ÆÌÜÛÅ
addr+=n_lines*2 + HELP_AT;
//ets_printf("HELP: display start 0x%05X\n", addr);

// òÉÓÕÅÍ ÓÔÒÏËÉ
int i;
for (i=0; i<30; i++)
{
// ðÒÏ×ÅÒÑÅÍ ÎÁ ËÏÎÅà ÔÅËÓÔÁ
if (line+i >= n_lines) break;

//ets_printf("HELP: line %d at 0x%05X\n", line+i, addr);

// þÉÔÁÅÍ ÔÅËÓÔ × ÂÕÆÅÒ
uint8_t buf[80]; // ÍÁËÓ. ÄÌÉÎÁ - 72 ÓÉÍ×ÏÌÁ + ÎÁ ×ÙÒÁ×ÎÉ×ÁÎÉÅ ÐÏ ÇÒÁÎÉÃÅ 4 ÂÁÊÔ
SPIRead(addr & ~0x03, (uint32_t*)buf, sizeof(buf));
uint8_t o=addr & 0x03;
uint8_t x=8;
while (buf[o])
{
ui_scr[4+i][x++]=buf[o++];
addr++;
}

// ïÞÉÝÁÅÍ ÏÓÔÁÔÏË ÓÔÒÏËÉ
while (x < 80)
ui_scr[4+i][x++]=0;

addr++; // ËÏÎÅÃ ÓÔÒÏËÉ
}
}


void help_display(void)
{
ui_start();

// þÉÔÁÅÍ ËÏÌ-×Ï ÓÔÒÏË (ÅÓÌÉ ÎÅ ÞÉÔÁÌÉ ÅÝÅ)
if (n_lines < 0)
{
uint16_t tmp[2];

SPIRead(HELP_AT, (uint32_t*)tmp, 4);
n_lines=tmp[0];
//ets_printf("HELP: n_lines=%d\n", n_lines);
}

draw:
// òÉÓÕÅÍ ÎÁ ÜËÒÁÎÅ
display();

// ïÂÒÁÂÁÔÙ×ÁÅÍ ËÎÏÐËÉ
while (1)
{
uint16_t c=ps2_read();

switch (c)
{
case PS2_ESC:
case PS2_MENU:
// ÷ÙÈÏÄ
goto done;

case PS2_UP:
// ÷×ÅÒÈ
if (line > 0)
{
line--;
goto draw;
}
break;

case PS2_DOWN:
// ÷ÎÉÚ
if (line+30 < n_lines)
{
line++;
goto draw;
}
break;

case PS2_PGUP:
// óÔÒÁÎÉÃÁ ××ÅÒÈ
if (line > 0)
{
line-=29;
if (line < 0) line=0;
goto draw;
}
break;

case PS2_PGDN:
// óÔÒÁÎÉÃÁ ×ÎÉÚ
if (line+30 < n_lines)
{
line+=29;
if (line+30 >= n_lines)
line=n_lines-30;
goto draw;
}
break;

case PS2_HOME:
// îÁÞÁÌÏ
if (line > 0)
{
line=0;
goto draw;
}
break;

case PS2_END:
// ëÏÎÅÃ
if (line+30 < n_lines)
{
line=n_lines-30;
goto draw;
}
break;
}
}

done:
ui_stop();
}
8 changes: 8 additions & 0 deletions soft/EmuAPP/src/help.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#ifndef HELP_H
#define HELP_H


void help_display(void);


#endif
6 changes: 6 additions & 0 deletions soft/EmuAPP/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include "ffs.h"
#include "zkg.h"
#include "reboot.h"
#include "help.h"
#include "board.h"


Expand Down Expand Up @@ -186,6 +187,11 @@ void main_program(void)
win=true;
break;

case PS2_MENU:
// ïÔÏÂÒÁÚÉÔØ ÓÐÒÁ×ËÕ
help_display();
break;

/*case PS2_F12:
// äÁÍÐ ÜËÒÁÎÁ
{
Expand Down
1 change: 1 addition & 0 deletions soft/EmuAPP/src/menu.c
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ void menu(void)
"õÐÒÁ×ÌÅÎÉÅ ÜÍÕÌÑÃÉÅÊ:\n"
"Scroll Lock - ôÕÒÂÏ ÒÅÖÉÍ\n"
"WIN+ëÕÒÓÏÒ - óÄ×ÉÇ ÉÚÏÂÒÁÖÅÎÉÑ\n"
"MENU - óÐÒÁ×ËÁ ÐÏ òÁÄÉÏ-86òë\n"
);
xsprintf(str, "RK8266 óÂÏÒËÁ #%d", (int)&__BUILD_NUMBER__);
ui_draw_text(64+6-ets_strlen(str), 33, str);
Expand Down
4 changes: 2 additions & 2 deletions soft/EmuAPP/src/ui.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#include "menu.h"


char ui_scr[38][78];
char ui_scr[38][80];


void ui_clear(void)
Expand Down Expand Up @@ -232,7 +232,7 @@ void ui_start(void)
save=screen;

// ðÅÒÅÎÁÓÔÒÁÉ×ÁÅÍ ÜËÒÁÎ ÐÏÄ ÓÅÂÑ
screen.screen_w=78;
screen.screen_w=80;
screen.screen_h=38;
screen.underline_y=7;
screen.char_h=8;
Expand Down
2 changes: 1 addition & 1 deletion soft/EmuAPP/src/ui.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include "ets.h"


extern char ui_scr[38][78];
extern char ui_scr[38][80];


void ui_clear(void);
Expand Down
22 changes: 11 additions & 11 deletions soft/EmuAPP/src/vg75.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,17 +74,17 @@ static uint8_t sreg=0x00;

static const uint8_t pg_tab[16]=
{
PG_BOTTOM | PG_RIGHT, // 0
PG_BOTTOM | PG_LEFT, // 1
PG_TOP | PG_RIGHT, // 2
PG_TOP | PG_LEFT, // 3
PG_BOTTOM | PG_HORIZ, // 4
PG_VERT | PG_LEFT, // 5
PG_VERT | PG_RIGHT, // 6
PG_TOP | PG_HORIZ, // 7
PG_HORIZ, // 8
PG_VERT, // 9
PG_VERT | PG_HORIZ, // A
PG_BOTTOM | PG_RIGHT, // 0 (0xC0)
PG_BOTTOM | PG_LEFT, // 1 (0xC4)
PG_TOP | PG_RIGHT, // 2 (0xC8)
PG_TOP | PG_LEFT, // 3 (0xCC)
PG_BOTTOM | PG_HORIZ, // 4 (0xD0)
PG_VERT | PG_LEFT, // 5 (0xD4)
PG_VERT | PG_RIGHT, // 6 (0xD8)
PG_TOP | PG_HORIZ, // 7 (0xDC)
PG_HORIZ, // 8 (0xE0)
PG_VERT, // 9 (0xE4)
PG_VERT | PG_HORIZ, // A (0xE8)
};


Expand Down
5 changes: 5 additions & 0 deletions soft/boot.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ cd WiFiAPP
make || exit
cd ..

cd help
./mkhelp || exit
cd ..

/home/heavy/KLAD/x-tools/esp8266/xtensa-lx106-elf/bin/esptool.py \
--port /dev/ttyUSB0 \
write_flash \
Expand All @@ -21,6 +25,7 @@ cd ..
0x00000 boot-2apps/out/boot.bin \
0x01000 EmuAPP/out/emu-0x00000.bin \
0x10000 WiFiAPP/out/wifi.1.bin \
0x50000 help/help.bin \
0x70000 WiFiAPP/httpfs/httpfs.bin \
|| exit

Expand Down
3 changes: 2 additions & 1 deletion soft/flash_layout.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
0x00000 4k ���������
0x01000 60k ��������
0x10000 256k ���������� ��� WiFi
0x50000 128k ---
0x50000 64k �������
0x60000 64k ---
0x70000 48k �������� ������� ��� HTTP-�������
0x7C000 16k ��������� ������� SDK
0x80000 �� ����� Flash-����
16 changes: 16 additions & 0 deletions soft/help/boot.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#! /bin/bash

./mkhelp || exit

/home/heavy/KLAD/x-tools/esp8266/xtensa-lx106-elf/bin/esptool.py \
--port /dev/ttyUSB0 \
write_flash \
--flash_size 8m \
--flash_freq 20m \
--flash_mode dio \
0x50000 help.bin \
|| exit

/home/heavy/KLAD/x-tools/esp8266/xtensa-lx106-elf/bin/esptool.py run || exit

telnet localhost 60485
Binary file added soft/help/help.bin
Binary file not shown.
Loading

0 comments on commit a39fa8b

Please sign in to comment.