kopia lustrzana https://github.com/PiInTheSky/lora-gateway
Working help screen & fixed padding bug for Telemetry causing the text (ytes) to remain on the screen
rodzic
dbaea0ba8b
commit
fda5265306
|
@ -942,7 +942,14 @@ void ProcessTelemetryMessage(int Channel, char *Message)
|
|||
{
|
||||
char *startmessage, *endmessage;
|
||||
|
||||
ChannelPrintf( Channel, 3, 1, "Telemetry %d bytes ", strlen( Message + 1 ) );
|
||||
char telem[40];
|
||||
char buffer[40];
|
||||
|
||||
sprintf(telem, "Telemetry %d bytes", strlen( Message + 1 ));
|
||||
|
||||
// Pad the string with spaces to the size of the window
|
||||
sprintf(buffer,"%-37s", telem );
|
||||
ChannelPrintf( Channel, 3, 1, buffer);
|
||||
|
||||
startmessage = Message;
|
||||
endmessage = strchr( startmessage, '\n' );
|
||||
|
|
56
gui.c
56
gui.c
|
@ -1,19 +1,47 @@
|
|||
#include "gui.h"
|
||||
#include <string.h>
|
||||
|
||||
// extern int help_win_displayed;
|
||||
|
||||
WINDOW *create_help_win(int height, int width, int starty, int startx);
|
||||
void destroy_help_win(WINDOW *local_win);
|
||||
|
||||
WINDOW *create_help_win(int height, int width, int starty, int startx)
|
||||
{ WINDOW *local_win;
|
||||
{
|
||||
WINDOW *local_win;
|
||||
char buffer [80];
|
||||
|
||||
local_win = newwin(height, width, starty, startx);
|
||||
box(local_win, 0 , 0); /* 0, 0 gives default characters
|
||||
* for the vertical and horizontal
|
||||
* lines */
|
||||
wbkgd( local_win, COLOR_PAIR( 2 ) );
|
||||
color_set( 2, NULL );
|
||||
|
||||
|
||||
|
||||
sprintf( buffer, " Command set for the LoRa Gateway ");
|
||||
mvaddstr( 1, ( 80 - strlen( buffer ) ) / 2, buffer );
|
||||
|
||||
sprintf( buffer, "Channel 0 commands are lower case (a-z)");
|
||||
mvaddstr( 3, ( 80 - strlen( buffer ) ) / 2, buffer );
|
||||
|
||||
sprintf( buffer, "Channel 1 commands are upper case (A-Z)");
|
||||
mvaddstr( 4, ( 80 - strlen( buffer ) ) / 2, buffer );
|
||||
|
||||
sprintf( buffer, "A = +100MHz Z= -100MHz");
|
||||
mvaddstr( 6, ( 80 - strlen( buffer ) ) / 2, buffer );
|
||||
|
||||
sprintf( buffer, "S = +10MHz X= -10MHz ");
|
||||
mvaddstr( 7, ( 80 - strlen( buffer ) ) / 2, buffer );
|
||||
|
||||
sprintf( buffer, "D = +1MHz C= -1MHz ");
|
||||
mvaddstr( 8, ( 80 - strlen( buffer ) ) / 2, buffer );
|
||||
|
||||
sprintf( buffer, "F = Toggle AFC ");
|
||||
mvaddstr( 10, ( 80 - strlen( buffer ) ) / 2, buffer );
|
||||
|
||||
sprintf( buffer, "M = Toggle Modes (This is not implemented yet!!!) ");
|
||||
mvaddstr( 12, ( 80 - strlen( buffer ) ) / 2, buffer );
|
||||
|
||||
wrefresh(local_win); /* Show that box */
|
||||
|
||||
return local_win;
|
||||
|
@ -24,27 +52,12 @@ void destroy_help_win(WINDOW *local_win)
|
|||
int i = 0;
|
||||
char buffer [80];
|
||||
|
||||
/* box(local_win, ' ', ' '); : This won't produce the desired
|
||||
* result of erasing the window. It will leave it's four corners
|
||||
* and so an ugly remnant of window.
|
||||
*/
|
||||
// Remove the border
|
||||
wborder(local_win, ' ', ' ', ' ',' ',' ',' ',' ',' ');
|
||||
/* The parameters taken are
|
||||
* 1. win: the window on which to operate
|
||||
* 2. ls: character to be used for the left side of the window
|
||||
* 3. rs: character to be used for the right side of the window
|
||||
* 4. ts: character to be used for the top side of the window
|
||||
* 5. bs: character to be used for the bottom side of the window
|
||||
* 6. tl: character to be used for the top left corner of the window
|
||||
* 7. tr: character to be used for the top right corner of the window
|
||||
* 8. bl: character to be used for the bottom left corner of the window
|
||||
* 9. br: character to be used for the bottom right corner of the window
|
||||
*/
|
||||
|
||||
|
||||
color_set( 3, NULL );
|
||||
for (i=1;i<15;i++)
|
||||
mvchgat(i, 39, 2, COLOR_PAIR(3), 0, NULL);
|
||||
|
||||
mvaddstr(i, 39, " ");
|
||||
|
||||
// Put the HELP message back
|
||||
sprintf( buffer, " Press (H) for Help ");
|
||||
|
@ -78,6 +91,5 @@ void gui_show_help ()
|
|||
};
|
||||
|
||||
destroy_help_win(help_win);
|
||||
// help_win_displayed = 0;
|
||||
|
||||
}
|
||||
|
|
Ładowanie…
Reference in New Issue