I've ported the patch to the WP 31S (attached) that was originally created to make data entry faster when using Y register display on the WP 34S. For more information on how it works, see
post #66 in the
Enhanced Y register display thread.
I've tried the patch on an HP 30b just for a few seconds to confirm that it indeed speeds up data entry even on the WP 31S. I hope the WP 31S community will find this patch useful, but I'm not very familiar with either the code or the behavior of the WP 31S, so someone else will need to take it up from here and test it thoroughly if it's to be integrated into the mainline.
Code:
diff -ur wp31s/data.h wp31s_r3680_20141112_fewer_screen_updates_on_data_entry/data.h
--- wp31s/data.h 2014-11-12 11:56:18.703334204 -0500
+++ wp31s_r3680_20141112_fewer_screen_updates_on_data_entry/data.h 2014-11-12 23:47:50.342964693 -0500
@@ -445,6 +445,7 @@
extern REGISTER *StackBase; // Location of the RPN stack
extern decContext Ctx; // decNumber library context
extern FLAG JustDisplayed; // Avoid duplicate calls to display();
+extern FLAG WasDataEntry; // No need to update the display
extern char TraceBuffer[]; // Display current instruction
#ifndef REALBUILD
extern char LastDisplayedText[NUMALPHA + 1]; // This is for the emulator (clipboard)
diff -ur wp31s/display.c wp31s_r3680_20141112_fewer_screen_updates_on_data_entry/display.c
--- wp31s/display.c 2014-11-12 11:56:18.691334204 -0500
+++ wp31s_r3680_20141112_fewer_screen_updates_on_data_entry/display.c 2014-11-12 23:47:50.342964693 -0500
@@ -1767,6 +1767,22 @@
return;
}
+ if (WasDataEntry) {
+#if defined(QTGUI) || defined(IOS)
+ xset(LastDisplayedNumber, ' ', NUMBER_LENGTH);
+ LastDisplayedNumber[NUMBER_LENGTH]=0;
+ xset(LastDisplayedExponent, ' ', EXPONENT_LENGTH);
+ LastDisplayedExponent[EXPONENT_LENGTH]=0;
+#endif
+ wait_for_display(); // Normally called from reset_disp()
+
+ // Erase 7-segment display
+ for (i = 0; i <= EXP_SIGN; ++i) {
+ clr_dot(i);
+ }
+ goto only_update_x;
+ }
+
// Clear display
reset_disp();
@@ -1961,6 +1977,7 @@
show_stack();
nostk: show_flags();
if (!skip) {
+only_update_x:
p = get_cmdline();
if (p == NULL || cata) {
if (ShowRegister != -1) {
@@ -1973,6 +1990,9 @@
disp_x(p);
x_disp = 1;
}
+ if (WasDataEntry) {
+ goto finish;
+ }
}
set_annunciators();
@@ -1994,6 +2014,7 @@
annunciators();
#endif
+finish:
State2.version = 0;
State2.disp_as_alpha = 0;
State2.smode = SDISP_NORMAL;
@@ -2209,6 +2230,7 @@
{
State2.disp_freeze = 0;
State2.disp_small = 0;
+ WasDataEntry = 0;
if ( State2.invalid_disp && str2 == NULL ) {
// Complete redraw necessary
DispMsg = str1;
diff -ur wp31s/keys.c wp31s_r3680_20141112_fewer_screen_updates_on_data_entry/keys.c
--- wp31s/keys.c 2014-11-12 11:56:18.695334203 -0500
+++ wp31s_r3680_20141112_fewer_screen_updates_on_data_entry/keys.c 2014-11-12 23:47:50.346964693 -0500
@@ -55,6 +55,8 @@
confirm_none=0, confirm_clall, confirm_reset, confirm_clprog, confirm_clpall
};
+FLAG WasDataEntry;
+
/* Local data to this module */
unsigned int OpCode;
FLAG OpCodeDisplayPending;
@@ -1867,6 +1869,7 @@
void process_keycode(int c)
{
static int was_paused;
+ volatile int cmdline_empty; // volatile because it's uninitialized in some cases
if (was_paused && Pause == 0) {
/*
@@ -1966,8 +1969,13 @@
dot(RPN, ShowRPN);
#ifndef CONSOLE
if (! State2.disp_temp ) {
- // This will get rid of the last displayed op-code
- display();
+ if (!WasDataEntry) {
+ // This will get rid of the last displayed op-code
+ display();
+ }
+ else {
+ finish_display(); // Update the RPN annunciator
+ }
}
#endif
return;
@@ -1984,6 +1992,7 @@
/*
* Decode the key
*/
+ WasDataEntry = 0;
ShowRPN = ! XromRunning; // Default behaviour, may be turned off later
c = process(c); // returns an op-code or state
@@ -2018,23 +2027,27 @@
// Data entry key
xcopy(&Undo2State, &UndoState, sizeof(TPersistentRam));
xcopy(&UndoState, &PersistentRam, sizeof(TPersistentRam));
+ WasDataEntry = 1;
+ cmdline_empty = (CmdLineLength == 0);
xeq(c);
+ cmdline_empty |= (CmdLineLength == 0);
} else {
// Save the op-code for execution on key-up
OpCode = c;
OpCodeDisplayPending = 1;
+ finish_display(); // Update the RPN annunciator
+ goto no_display; // No need to update the display before the command is executed
}
}
}
-#ifndef CONSOLE
if (! XromRunning && ! Pause && ! JustDisplayed && c != STATE_IGNORE) {
+ const int orig_WasDataEntry = WasDataEntry;
+
+ WasDataEntry &= !(c == (OP_SPEC | OP_ENTER) || cmdline_empty || State2.invalid_disp);
display();
+ WasDataEntry = orig_WasDataEntry;
}
-#else
- if (! XromRunning && ! Pause && c != STATE_IGNORE && ! JustDisplayed) {
- display();
- }
-#endif
+no_display:
JustDisplayed = 0;
watchdog();
}