Event History Setup: #287

Allow Event History to be cycled from short string on, long string on, or of with the 'h' shortcut keyf;
This commit is contained in:
lwvmobile
2025-05-12 17:12:10 -04:00
parent f85304471f
commit 59fcfdae81
4 changed files with 18 additions and 15 deletions

View File

@@ -171,7 +171,7 @@ Some Keyboard Shortcuts have been implemented for testing to see how users like
esc or arrow keys - ncurses menu esc or arrow keys - ncurses menu
q - quit q - quit
c - toggle compact mode c - toggle compact mode
h - toggle event history h - cycle event history short, long, or off
z - toggle console payloads z - toggle console payloads
a - toggle call alert beep a - toggle call alert beep
4 - force privacy/scrambler key assertion over enc identifiers (dmr and nxdn) 4 - force privacy/scrambler key assertion over enc identifiers (dmr and nxdn)

View File

@@ -387,9 +387,9 @@ typedef struct
pa_simple *pulse_digi_dev_outR; pa_simple *pulse_digi_dev_outR;
char pa_input_idx[100]; char pa_input_idx[100];
char pa_output_idx[100]; char pa_output_idx[100];
int use_ncurses_terminal; uint8_t use_ncurses_terminal;
int ncurses_compact; uint8_t ncurses_compact;
int ncurses_history; uint8_t ncurses_history;
int reset_state; int reset_state;
int payload; int payload;
char output_name[1024]; char output_name[1024];

View File

@@ -201,10 +201,10 @@ uint8_t ncurses_input_handler(dsd_opts * opts, dsd_state * state, int c)
else opts->call_alert = 1; else opts->call_alert = 1;
} }
if (c == 104) //'h' key, toggle history if (c == 104) //'h' key, cycle history off, short, long
{ {
if (opts->ncurses_history == 1) opts->ncurses_history = 0; opts->ncurses_history++;
else opts->ncurses_history = 1; opts->ncurses_history %= 3;
} }
if (c == 113) //'q' key, quit if (c == 113) //'q' key, quit

View File

@@ -1590,13 +1590,15 @@ ncursesPrinter (dsd_opts * opts, dsd_state * state)
attroff(COLOR_PAIR(3)); attroff(COLOR_PAIR(3));
} }
//only print event history if enabled //only print event history if enabled
if (opts->ncurses_history == 1) attron(COLOR_PAIR(4)); //cyan for history
printw ("--Latest Event History ([|])---Slot %d (\\)---Cycle (h)-Short/Long/Off----------\n", state->eh_slot+1);
if (opts->ncurses_history != 0)
{ {
attron(COLOR_PAIR(4)); //cyan for history
printw ("--Latest Event History ([|])---Slot %d (\\)-------------------------------------\n", state->eh_slot+1);
for (uint16_t i = (state->eh_index+1); i < (state->eh_index+11); i++) for (uint16_t i = (state->eh_index+1); i < (state->eh_index+11); i++)
{ {
uint16_t string_size = 71; //short uniform size that doesn't exceed the fence
if (opts->ncurses_history == 2)
string_size = 1999; //full string size
uint8_t slot = state->eh_slot; uint8_t slot = state->eh_slot;
uint8_t color_pair = state->event_history_s[slot].Event_History_Items[i%255].color_pair; //this is the color pair assignment for this line uint8_t color_pair = state->event_history_s[slot].Event_History_Items[i%255].color_pair; //this is the color pair assignment for this line
attron(COLOR_PAIR(4)); attron(COLOR_PAIR(4));
@@ -1605,8 +1607,8 @@ ncursesPrinter (dsd_opts * opts, dsd_state * state)
sprintf (text_string, "%s", "BUMBLEBEETUNA"); sprintf (text_string, "%s", "BUMBLEBEETUNA");
if (strncmp(text_string, state->event_history_s[slot].Event_History_Items[i%255].event_string, 13) != 0) if (strncmp(text_string, state->event_history_s[slot].Event_History_Items[i%255].event_string, 13) != 0)
{ {
memcpy(text_string, state->event_history_s[slot].Event_History_Items[i%255].event_string, 71*sizeof(char)); memcpy(text_string, state->event_history_s[slot].Event_History_Items[i%255].event_string, string_size*sizeof(char));
text_string[71] = 0; //terminate string text_string[string_size] = 0; //terminate string
printw ("| #%03d ", i%255); printw ("| #%03d ", i%255);
attron(COLOR_PAIR(color_pair)); //this is where the custom color switch occurs for the event_string attron(COLOR_PAIR(color_pair)); //this is where the custom color switch occurs for the event_string
printw ("%s\n", text_string); printw ("%s\n", text_string);
@@ -1648,10 +1650,11 @@ ncursesPrinter (dsd_opts * opts, dsd_state * state)
} }
} }
printw ("------------------------------------------------------------------------------\n");
attroff(COLOR_PAIR(4)); //cyan for history
} }
printw ("------------------------------------------------------------------------------\n");
attroff(COLOR_PAIR(4)); //cyan for history
refresh(); refresh();
//handle input //handle input