Skip to content

Commit

Permalink
v2.1.6 maintenance update, tightening up comm to make interaction wit…
Browse files Browse the repository at this point in the history
…h druid more reliable. Also added additional support for upcoming platforms.
  • Loading branch information
Malaclypse The Younger committed Aug 24, 2017
1 parent 8d655b6 commit 04cd44f
Show file tree
Hide file tree
Showing 15 changed files with 346 additions and 105 deletions.
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=SerialUI
version=2.1.4
version=2.1.6
author=Pat Deegan
maintainer=Pat Deegan <[email protected]>
sentence=A user interface through the serial channel (menus, sub-menus, input requests and command execution) and a GUI back-end, with support for navigation through the menu hierarchy and online help.
Expand Down
8 changes: 8 additions & 0 deletions src/Delegate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,12 @@ unsigned long Interface::parseIntHex(char skipChar)
int Interface::timedRead()
{
int c;
uint8_t tickCount = 0;
unsigned long startMillis = PLATFORM_NOW_MILLIS();
do {
if (tickCount++ % 20 == 0) {
this->poll();
}
this->tick(false);
c = read();
if (c >= 0) return c;
Expand All @@ -140,8 +144,12 @@ int Interface::timedRead()
int Interface::timedPeek()
{
int c;
uint8_t tickCount = 0;
unsigned long startMillis = PLATFORM_NOW_MILLIS();
do {
if (tickCount++ % 20 == 0) {
this->poll();
}
this->tick(false);
c = this->peek();
if (c >= 0) return c;
Expand Down
48 changes: 26 additions & 22 deletions src/SUIMenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -752,17 +752,25 @@ Menu * Menu::handleRequest() {

}

#define SUI_MEN_PRINTSPACES(num) stopIdx = (num); spacesBuf[stopIdx] = '\0'; \
sui_driver->print(spacesBuf); spacesBuf[stopIdx] = ' ';

void Menu::printHelpKey(MenuItem::Base * menuitem) {
SOVA_FLASHSTRING_PTR help_sep_to_use;

uint8_t stopIdx;
char spacesBuf[SUI_SERIALUI_KEYHELP_SEP_REPEATS_MAX + 1];
bool include_pretty_print = true;
SUI::Mode::Selection curMode = Mode::User;


#ifdef SUI_ENABLE_MODES
curMode = sui_driver->mode();
if (sui_driver->mode() == Mode::User)
{
help_sep_to_use = help_sep;

memset(spacesBuf, ' ', SUI_SERIALUI_KEYHELP_SEP_REPEATS_MAX + 1);

} else {

help_sep_to_use = help_sep_prog;
Expand All @@ -783,12 +791,8 @@ void Menu::printHelpKey(MenuItem::Base * menuitem) {
if (include_pretty_print)
{
// we need to put in some spacing, for the help message
for (uint8_t i = 0;
i < (SUI_SERIALUI_KEYHELP_SEP_REPEATS_MAX - menuitem->key_size);
i++) {
SUI_MEN_PRINTSPACES((SUI_SERIALUI_KEYHELP_SEP_REPEATS_MAX - menuitem->key_size));

SUIDRIVER_PRINT_FLASH(help_sep_to_use);
}
} else {

SUIDRIVER_PRINT_FLASH(help_sep_to_use);
Expand All @@ -798,8 +802,11 @@ void Menu::printHelpKey(MenuItem::Base * menuitem) {

void Menu::showHelp() {

char spacesBuf[SUI_SERIALUI_KEYHELP_SEP_REPEATS_MAX + 1];

bool in_program_mode = false;

memset(spacesBuf, ' ', SUI_SERIALUI_KEYHELP_SEP_REPEATS_MAX + 1);
#ifdef SUI_ENABLE_MODES
if (sui_driver->mode() == Mode::Program)
{
Expand Down Expand Up @@ -841,38 +848,30 @@ void Menu::showHelp() {

sui_driver->println(' ');

uint8_t stopIdx;

if (parent_menu) {
#ifdef SUI_MENU_ENABLE_SUBMENUS
SUIDRIVER_PRINT_FLASH(help_key_commandprefix);
SUIDRIVER_PRINT_FLASH(up_key);
for (uint8_t i = 0;
i < SUI_SERIALUI_KEYHELP_SEP_REPEATS_MAX - STRLEN_FLASHSTR(up_key);
i++) {

SUIDRIVER_PRINT_FLASH(help_sep);
}
SUI_MEN_PRINTSPACES(SUI_SERIALUI_KEYHELP_SEP_REPEATS_MAX - STRLEN_FLASHSTR(up_key));

SUIDRIVER_PRINTLN_FLASH(up_help);
#endif
} else {
SUIDRIVER_PRINT_FLASH(help_key_commandprefix);
SUIDRIVER_PRINT_FLASH(exit_key);
for (uint8_t i = 0;
i < SUI_SERIALUI_KEYHELP_SEP_REPEATS_MAX - STRLEN_FLASHSTR(exit_key);
i++) {

SUIDRIVER_PRINT_FLASH(help_sep);
}
SUI_MEN_PRINTSPACES(SUI_SERIALUI_KEYHELP_SEP_REPEATS_MAX - STRLEN_FLASHSTR(exit_key));

SUIDRIVER_PRINTLN_FLASH(exit_help);
}

SUIDRIVER_PRINT_FLASH(help_key_commandprefix);
SUIDRIVER_PRINT_FLASH(help_key);
for (uint8_t i = 0;
i < SUI_SERIALUI_KEYHELP_SEP_REPEATS_MAX - STRLEN_FLASHSTR(help_key);
i++) {
SUIDRIVER_PRINT_FLASH(help_sep);
}
SUI_MEN_PRINTSPACES(SUI_SERIALUI_KEYHELP_SEP_REPEATS_MAX - STRLEN_FLASHSTR(help_key));

SUIDRIVER_PRINTLN_FLASH(help_help);

}
Expand Down Expand Up @@ -1025,9 +1024,14 @@ void Menu::returnMessage(SOVA_FLASHSTRING_PTR message) {

void Menu::showName() { SUIDRIVER_PRINT_FLASH(menu_name); }

#ifdef SUI_STATE_TRACK_ALWAYSFULL
#define SUIMENU_SHOWTRACKSTATE_FORCE true
#else
#define SUIMENU_SHOWTRACKSTATE_FORCE false
#endif
void Menu::pingRespond() {
#ifdef SUI_ENABLE_STATE_TRACKER
if (sui_driver->showTrackedState())
if (sui_driver->showTrackedState(SUIMENU_SHOWTRACKSTATE_FORCE))
{
return;
}
Expand Down
Loading

0 comments on commit 04cd44f

Please sign in to comment.