Skip to content

Commit

Permalink
Do not allow changes to feed/thread, metric/imperial, forward/reverse…
Browse files Browse the repository at this point in the history
…, or settings when the machine is running.
  • Loading branch information
clough42 committed Oct 6, 2020
1 parent 9debd0b commit 94ebec9
Showing 1 changed file with 28 additions and 19 deletions.
47 changes: 28 additions & 19 deletions els-f280049c/UserInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,9 @@ void UserInterface :: loop( void )
{
const FEED_THREAD *newFeed = NULL;

// read the RPM up front so we can use it to make decisions
Uint16 currentRpm = core->getRPM();

// display an override message, if there is one
overrideMessage();

Expand All @@ -128,22 +131,32 @@ void UserInterface :: loop( void )
keys = controlPanel->getKeys();

// respond to keypresses
if( keys.bit.IN_MM )
{
this->metric = ! this->metric;
newFeed = loadFeedTable();
}
if( keys.bit.FEED_THREAD )
if( currentRpm == 0 )
{
this->thread = ! this->thread;
newFeed = loadFeedTable();
}
if( keys.bit.FWD_REV )
{
this->reverse = ! this->reverse;
// feed table hasn't changed, but we need to trigger an update
newFeed = loadFeedTable();
// these keys should only be sensitive when the machine is stopped
if( keys.bit.IN_MM )
{
this->metric = ! this->metric;
newFeed = loadFeedTable();
}
if( keys.bit.FEED_THREAD )
{
this->thread = ! this->thread;
newFeed = loadFeedTable();
}
if( keys.bit.FWD_REV )
{
this->reverse = ! this->reverse;
// feed table hasn't changed, but we need to trigger an update
newFeed = loadFeedTable();
}
if( keys.bit.SET )
{
setMessage(&SETTINGS_MESSAGE_1);
}
}

// these keys can be operated when the machine is running
if( keys.bit.UP )
{
newFeed = feedTable->next();
Expand All @@ -152,10 +165,6 @@ void UserInterface :: loop( void )
{
newFeed = feedTable->previous();
}
if( keys.bit.SET )
{
setMessage(&SETTINGS_MESSAGE_1);
}

// if we have changed the feed
if( newFeed != NULL ) {
Expand All @@ -170,7 +179,7 @@ void UserInterface :: loop( void )
}

// update the RPM display
controlPanel->setRPM(core->getRPM());
controlPanel->setRPM(currentRpm);

// write data out to the display
controlPanel->refresh();
Expand Down

0 comments on commit 94ebec9

Please sign in to comment.