From 85b5fde272be6ab543aa866baebabddc24566bdb Mon Sep 17 00:00:00 2001 From: cheapie Date: Sat, 23 May 2026 20:14:34 -0500 Subject: Add initial content --- c/menu/digilines.c | 66 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 c/menu/digilines.c (limited to 'c/menu/digilines.c') diff --git a/c/menu/digilines.c b/c/menu/digilines.c new file mode 100644 index 0000000..620d61f --- /dev/null +++ b/c/menu/digilines.c @@ -0,0 +1,66 @@ +/* Menu Thing for RVController - Digilines + * A product of Advanced Mesecons Devices, a Cheapie Systems company + * This is free and unencumbered software released into the public domain. + * See http://unlicense.org/ for more information */ + +#include +#include +#include "rvcontroller-ecalls.h" + +char dispbuf[] = "\nLast channel:\n(none) \nLast message:\n(none) \ns: Send\nq: Quit"; + +void dispWrite(char *text,int pos) { + int outpos; + for (int i=0;;i++) { + if (text[i] == 0) { break; } + outpos = pos + i; + dispbuf[outpos] = text[i]; + } +} + +void sendUI(void) { + char channeloutbuf[19]; + char msgoutbuf[19]; + printstr("\n\n\n\n\nEnter channel:\n> "); + readstr(channeloutbuf,19); + printstr(channeloutbuf); + printstr("\nEnter message:\n> "); + readstr(msgoutbuf,19); + printstr(msgoutbuf); + digiline_send(channeloutbuf,msgoutbuf); + printstr("\nSent!\nPress any key"); + readstr(channeloutbuf,1); +} + +void runDigilines(void) { + char channelinbuf[21]; + char msginbuf[21]; + char kbinput; + bool quit = false; + + console_clearbuffer(); + digiline_clearbuffer(); + dispWrite("(none) ",15); + dispWrite("(none) ",50); + + while (!quit) { + if (digiline_bufferlevel() > 0) { + digiline_receive(channelinbuf,21,msginbuf,21); + dispWrite(" ",15); + dispWrite(" ",50); + dispWrite(channelinbuf,15); + dispWrite(msginbuf,50); + } + printstr(dispbuf); + + kbinput = console_readchar(); + switch (kbinput) { + case 's': + sendUI(); + break; + case 'q': + quit = true; + break; + } + } +} -- cgit v1.2.3