SET SCREEN
Added a SCREEN setting to set the interaction screen for Foenix machines with more than one text screen.
This commit is contained in:
parent
fd6cdee557
commit
50797494e6
|
@ -76,6 +76,7 @@ extern short cmd_cls(short channel, int argc, const char * argv[]);
|
|||
extern short cmd_showint(short channel, int argc, const char * argv[]);
|
||||
extern short cmd_getjiffies(short channel, int argc, const char * argv[]);
|
||||
extern short cmd_get_ticks(short channel, int argc, const char * argv[]);
|
||||
extern short cmd_screen(short channel, int argc, const char * argv[]);
|
||||
|
||||
/*
|
||||
* Variables
|
||||
|
@ -124,6 +125,24 @@ const t_cli_command g_cli_commands[] = {
|
|||
{ 0, 0 }
|
||||
};
|
||||
|
||||
/**
|
||||
* Set the number of the channel to use for interactions
|
||||
*
|
||||
* @param channel the number of the text device to use
|
||||
*/
|
||||
void cli_channel_set(short channel) {
|
||||
g_current_channel = channel;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the number of the channel to use for interactions
|
||||
*
|
||||
* @return channel the number of the text device to use
|
||||
*/
|
||||
short cli_channel_get() {
|
||||
return g_current_channel;
|
||||
}
|
||||
|
||||
//
|
||||
// List all the commands
|
||||
//
|
||||
|
@ -669,27 +688,27 @@ short cli_repl(short channel, const char * init_cwd) {
|
|||
if (result) {
|
||||
char message[80];
|
||||
sprintf(message, "Unable to set startup directory: %s\n", err_message(result));
|
||||
print(channel, message);
|
||||
print(g_current_channel, message);
|
||||
}
|
||||
}
|
||||
|
||||
while (1) {
|
||||
sys_chan_write(channel, "\n", 1);
|
||||
sys_chan_write(g_current_channel, "\n", 1);
|
||||
// TODO: write the current directory to the status line
|
||||
// if(sys_fsys_get_cwd(cwd_buffer, MAX_PATH_LEN) == 0) {
|
||||
// sys_chan_write(channel, cwd_buffer, strlen(cwd_buffer));
|
||||
// }
|
||||
sys_chan_write(channel, "\x10 ", 2); // Print our prompt
|
||||
sys_chan_write(g_current_channel, "\x10 ", 2); // Print our prompt
|
||||
|
||||
result = cli_readline(channel, command_line);
|
||||
result = cli_readline(g_current_channel, command_line);
|
||||
switch (result) {
|
||||
case -1:
|
||||
channel = (channel == 0) ? 1 : 0;
|
||||
g_current_channel = (g_current_channel == 0) ? 1 : 0;
|
||||
break;
|
||||
|
||||
case -2:
|
||||
print(channel, "\n");
|
||||
cmd_help(channel, 0, 0);
|
||||
print(g_current_channel, "\n");
|
||||
cmd_help(g_current_channel, 0, 0);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -703,9 +722,9 @@ short cli_repl(short channel, const char * init_cwd) {
|
|||
}
|
||||
// sys_chan_readline(channel, command_line, MAX_COMMAND_SIZE); // Attempt to read line
|
||||
|
||||
sys_chan_write(channel, "\n", 1);
|
||||
sys_chan_write(g_current_channel, "\n", 1);
|
||||
|
||||
cli_process_line(channel, command_line);
|
||||
cli_process_line(g_current_channel, command_line);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -54,4 +54,18 @@ extern short cmd_help(short channel, int argc, const char * argv[]);
|
|||
*/
|
||||
extern short cli_exec_batch(short channel, const char * path);
|
||||
|
||||
/**
|
||||
* Set the number of the channel to use for interactions
|
||||
*
|
||||
* @param channel the number of the text device to use
|
||||
*/
|
||||
extern void cli_channel_set(short channel);
|
||||
|
||||
/**
|
||||
* Get the number of the channel to use for interactions
|
||||
*
|
||||
* @return channel the number of the text device to use
|
||||
*/
|
||||
extern short cli_channel_get();
|
||||
|
||||
#endif
|
||||
|
|
|
@ -514,6 +514,32 @@ short cli_keycolor_get(short channel, char * value, short size) {
|
|||
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Set the number of the text screen to use for interactions
|
||||
*/
|
||||
short cli_screen_set(short channel, const char * value) {
|
||||
char message[80];
|
||||
t_sys_info info;
|
||||
short screen = (short)cli_eval_number(value);
|
||||
|
||||
sys_get_info(&info);
|
||||
if (screen < info.screens) {
|
||||
cli_channel_set(screen);
|
||||
} else {
|
||||
sprintf(message, "Screen #%d not present.\n", screen);
|
||||
print(channel, message);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the number of the text screen to use for interactions
|
||||
*/
|
||||
short cli_screen_get(short channel, const char * value) {
|
||||
sprintf(value, "%d", cli_channel_get());
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Initialize the settings tables
|
||||
*/
|
||||
|
@ -529,6 +555,7 @@ void cli_set_init() {
|
|||
#if MODEL == MODEL_FOENIX_A2560K
|
||||
cli_set_register("KEYCOLOR", "KEYCOLOR 0x0RGB -- set the keyboard color", cli_keycolor_set, cli_keycolor_get);
|
||||
#endif
|
||||
cli_set_register("SCREEN", "SCREEN <0 - 1> -- set the channel number to use for interactions", cli_screen_set, cli_screen_get);
|
||||
cli_set_register("TIME", "TIME HH:MM:SS -- set the time in the realtime clock", cli_time_set, cli_time_get);
|
||||
cli_set_register("VOLUME", "VOLUME <0 - 255> -- set the master volume", cli_volume_set, cli_volume_get);
|
||||
}
|
||||
|
|
3241
src/foenixmcp.s68
3241
src/foenixmcp.s68
File diff suppressed because it is too large
Load diff
8231
src/mapfile
8231
src/mapfile
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue