Enhanced Y register display has been incorporated into version 3.3 of the WP 34S which is currently being developed, see
this thread.
However, the patch to reduce the number of screen updates and improve responsiveness on the 30b hardware has not been committed to SVN yet (see the explanations in
post #25, point 3 and in
post #34, point 1). You'll find it below and it's included in the last binary I published (see
post #13). The patch is small but somewhat tricky. Any feedback about potential bugs or unexpected behavior would be very welcome.
Code:
diff -ur wp34s-code/data.h wp34s-code_r3607_20140409_fewer_screen_updates_on_data_entry/data.h
--- wp34s-code/data.h 2014-04-07 12:22:01.813519672 -0400
+++ wp34s-code_r3607_20140409_fewer_screen_updates_on_data_entry/data.h 2014-04-09 23:21:42.289210691 -0400
@@ -473,6 +473,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 wp34s-code/display.c wp34s-code_r3607_20140409_fewer_screen_updates_on_data_entry/display.c
--- wp34s-code/display.c 2014-04-07 12:22:01.813519672 -0400
+++ wp34s-code_r3607_20140409_fewer_screen_updates_on_data_entry/display.c 2014-04-09 23:21:42.289210691 -0400
@@ -1916,6 +1916,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();
@@ -2117,6 +2133,7 @@
nostk: show_flags();
if (!skip) {
if (State2.runmode) {
+only_update_x:
p = get_cmdline();
if (p == NULL || cata) {
if (ShowRegister != -1) {
@@ -2129,6 +2146,9 @@
disp_x(p);
x_disp = 1;
}
+ if (WasDataEntry) {
+ goto finish;
+ }
} else {
unsigned int pc = state_pc();
unsigned int upc = user_pc(pc);
@@ -2176,6 +2196,7 @@
annunciators();
#endif
+finish:
State2.version = 0;
State2.disp_as_alpha = 0;
State2.smode = SDISP_NORMAL;
@@ -2391,6 +2412,7 @@
{
State2.disp_freeze = 0;
State2.disp_small = 0;
+ WasDataEntry = 0;
if ( State2.invalid_disp && str2 == NULL ) {
// Complete redraw necessary
DispMsg = str1;
diff -ur wp34s-code/keys.c wp34s-code_r3607_20140409_fewer_screen_updates_on_data_entry/keys.c
--- wp34s-code/keys.c 2014-03-04 21:31:09.142046108 -0500
+++ wp34s-code_r3607_20140409_fewer_screen_updates_on_data_entry/keys.c 2014-04-09 23:21:42.293210691 -0400
@@ -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;
@@ -2497,6 +2499,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) {
/*
@@ -2623,8 +2626,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;
@@ -2641,6 +2649,7 @@
/*
* Decode the key
*/
+ WasDataEntry = 0;
ShowRPN = ! Running; // Default behaviour, may be turned off later
c = process(c); // returns an op-code or state
@@ -2681,13 +2690,19 @@
default:
if (State2.runmode || NonProgrammable) {
NonProgrammable = 0;
- if (c >= (OP_SPEC | OP_ENTER) && c <= (OP_SPEC | OP_F))
+ if (c >= (OP_SPEC | OP_ENTER) && c <= (OP_SPEC | OP_F)) {
// Data entry key
+ 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
}
}
else {
@@ -2695,15 +2710,19 @@
}
}
}
+ if (! Running && ! Pause
#ifndef CONSOLE
- if (! Running && ! Pause && ! JustStopped && ! JustDisplayed && c != STATE_IGNORE) {
- display();
- }
-#else
- if (! Running && ! Pause && c != STATE_IGNORE && ! JustDisplayed) {
+ && ! JustStopped
+#endif
+ && ! JustDisplayed && c != STATE_IGNORE) {
+ const int orig_WasDataEntry = WasDataEntry;
+
+ WasDataEntry &= !(c == (OP_SPEC | OP_ENTER) || cmdline_empty || State2.invalid_disp);
display();
+ WasDataEntry = orig_WasDataEntry;
}
-#endif
+
+no_display:
JustDisplayed = 0;
watchdog();
}