WP34S for the DM42

This is where developers can exchange ideas and ask questions relevant to the DM42 firmware.

Please note that Swiss Micros staff are unable to provide answers here as a general rule. This is intended as a community-driven forum.
Nigel (UK)
Posts: 67
Joined: Fri Jul 21, 2017 11:08 pm

Re: WP34S for the DM42

Post by Nigel (UK) »

Previously the WP 34C and WP 34S calculators had different memory layouts. On the original hardware this was because extra RAM (which came from two program steps) was needed for the flags used by complex lock mode, and this carried over to the WP 34C on the DM42 hardware.

This has now changed. Some of the flags needed on the original calculator (e.g., contrast, fast/slow) aren't used on the DM42. By reclaiming these flags it has been possible to fit everything into the memory layout of the original WP 34S. (Just!) This means that there is no longer any reason to have a WP 34S branch without complex lock mode.

So now the master branch of the gitlab repository now contains a WP 34S with all features, including complex lock mode! The WP 34C branch has all of the same features, but a non-standard memory map and two fewer program steps.

There is absolutely no need for people who have been using the WP 34C program to change across (although you should update your program file and copy across a new help file, help/wp34c_help.html). I'll apply any bug fixes or enhancements to both branches. If you do change across you will find that the WP 34S boots up with the same library contents as your WP 34C, but with no programs or data in RAM. This isn't a problem. You can either save programs that you care about to library first (this is common to both programs), or:
  • Having EXITed the WP 34C program, enable the USB disk and connect your calculator to your computer.
  • Go to wp34s/ and copy/rename wp34c.dat to wp34s-backup.dat
  • Now, when you start up the wp34s program it will load the state of your wp34c machine into its backup region.
  • You can copy the programs from backup into RAM using the LOADP command, in the P.FCN catalogue.
  • The data, statistics, and stack register contents can not be easily transferred due to the different memory layouts. If this is a huge problem for you, I suggest you leave things as they are.
  • Having copied the programs, press OnSTO from the SETUP menu to create a backup with the correct memory map.
As mentioned above, if you are staying with the WP 34C program there is a new help file, help/wp34c_help.html. You'll need to copy this into your help/ folder if you update as the WP 34C programs now look for this file when HELP is pressed.

There is also more documentation in the help/ folder in the git repository, in both branches.

I hope this is clear!

Nigel (UK)
User avatar
Jaymos
Posts: 789
Joined: Sun Nov 04, 2018 7:03 pm
Location: Cape Town

Re: WP34S for the DM42

Post by Jaymos »

Well done Nigel!

I will certainly try it out!
Jaco Mostert
Elec Eng, South Africa
C43 (WP34C) on DM42 sn. 03818 & 06199 for complex math, HP42S; HP32Sii, WP34S&C, HP28C, HP35s, EL-506P, EL-W506, PB700; owned FX702P & 11C; used HP67 & HP85; iOS: 42s Byron, Free42, WP31S/34S, HCalc.
Nigel (UK)
Posts: 67
Joined: Fri Jul 21, 2017 11:08 pm

Re: WP34S for the DM42

Post by Nigel (UK) »

Since my last post there have been a few small changes and enhancements to the WP 34S and WP 34C programs. The program files for both versions are now in the build/ directory of the master branch.

Briefly, this is what has changed:
  • New display code - the entire display is no longer redrawn every time a key is pressed.
  • The WP 34S printer graphics commands are now included.
  • The "top row" versions of the program now display short messages in the top row rather than the alpha row.
  • Better support of compiled program files produced by the assembler.
  • New "4k" version of the WP 34S with an unimaginable 4k of RAM(!)
More details about all of these in the README.md file in the master branch of the gitlab repository.

I quite understand that none of these features are must-haves, but if anyone does try them please report any bugs you find! Changing the display-drawing code certainly caused some problems, but I think these are now fixed.

Nigel (UK)
User avatar
Jaymos
Posts: 789
Joined: Sun Nov 04, 2018 7:03 pm
Location: Cape Town

Re: WP34S for the DM42

Post by Jaymos »

Nigel,

I measured the current used by WP34S* on DM42 on USB power, and the power usage pattern is: full power from switch-on to switch-off. If you do not switch off, it draws full power until auto-shutdown, which comes after about 10 min.

I cannot post images due to "board attachment quota reached", but I can show that the startup current peaks at about 150 mA for about 50 us, dropping to about 20 mA full power until switch off. There are very short bursts of additional current every 2 seconds on top of the 20 mA full power, which is probably the DMCP time keeper. There is no sleeping of the processor until shutdown.

I did not measure battery power, but measured USB power, assuming you do not have different processor sleep control in the different powered modes. Of course we know the current usage is about 4 times higher in USB (20 mA vs. 5 mA), but that should be the only difference.

On the C43 and WP43S we let the processor sleep soon after the last key was released. The methodologies are different due to different key processing approaches, and the idea is to drop the full power to sleep power as soon as user interaction is not present.

Assuming about 5 mA battery drain at full power, and the same usage pattern of 10 min full power after last keypress, it costs about 5 mA x 10 min / 60 min / 235 mAh * 100 = 0.35% of the battery for every timeout cycle. Until that is improved with auto sleep mode, simply use the OFF command to save battery.

Edit at *, corrected 43/34 typo
Jaco Mostert
Elec Eng, South Africa
C43 (WP34C) on DM42 sn. 03818 & 06199 for complex math, HP42S; HP32Sii, WP34S&C, HP28C, HP35s, EL-506P, EL-W506, PB700; owned FX702P & 11C; used HP67 & HP85; iOS: 42s Byron, Free42, WP31S/34S, HCalc.
User avatar
Jaymos
Posts: 789
Joined: Sun Nov 04, 2018 7:03 pm
Location: Cape Town

Re: WP34S for the DM42

Post by Jaymos »

Nigel,

I did some more testing, this time I took the trouble to measure actual battery consumption, not USB current.

I still cannot paste images or files here, so head over to the message of 2021-07-31 in the link below to see pdfs of the oscillographs, here: https://gitlab.com/Jaymos/wp43c/-/issue ... _640145408
Jaco Mostert
Elec Eng, South Africa
C43 (WP34C) on DM42 sn. 03818 & 06199 for complex math, HP42S; HP32Sii, WP34S&C, HP28C, HP35s, EL-506P, EL-W506, PB700; owned FX702P & 11C; used HP67 & HP85; iOS: 42s Byron, Free42, WP31S/34S, HCalc.
Nigel (UK)
Posts: 67
Joined: Fri Jul 21, 2017 11:08 pm

Re: WP34S for the DM42

Post by Nigel (UK) »

Jaymos wrote:
Sat Jul 31, 2021 4:11 pm
Nigel,

I did some more testing, this time I took the trouble to measure actual battery consumption, not USB current.

I still cannot paste images or files here, so head over to the message of 2021-07-31 in the link below to see pdfs of the oscillographs, here: https://gitlab.com/Jaymos/wp43c/-/issue ... _640145408
Thank you for this. I had suspected a problem as I've had to replace batteries a couple of times during development, but I wasn't sure whether this was due to the frequent firmware flashing that took place. I recently re-wrote the display code to be less processor-intensive but it seems that this wasn't the problem.

I certainly have a call to sys_sleep() as part of the main loop; immediately before calling this, I start a timer which will wake the system after 100ms if another key isn't pressed first. This "heartbeat" is used to time pauses and to decide when to display a key's function and when to display NULL. It works, so that this part of the code is definitely being reached. I'll look at it more closely and perhaps compare it with WP43S/C. So far as I remember I used the template from the "example" calculator with minimal modifications, so I hope that the problem won't be too hard to find!

Nigel (UK)
User avatar
Jaymos
Posts: 789
Joined: Sun Nov 04, 2018 7:03 pm
Location: Cape Town

Re: WP34S for the DM42

Post by Jaymos »

Nigel (UK) wrote:
Sat Jul 31, 2021 6:31 pm
Jaymos wrote:
Sat Jul 31, 2021 4:11 pm
Nigel,

I did some more testing, this time I took the trouble to measure actual battery consumption, not USB current.

I still cannot paste images or files here, so head over to the message of 2021-07-31 in the link below to see pdfs of the oscillographs, here: https://gitlab.com/Jaymos/wp43c/-/issue ... _640145408
Thank you for this. I had suspected a problem as I've had to replace batteries a couple of times during development, but I wasn't sure whether this was due to the frequent firmware flashing that took place. I recently re-wrote the display code to be less processor-intensive but it seems that this wasn't the problem.

I certainly have a call to sys_sleep() as part of the main loop; immediately before calling this, I start a timer which will wake the system after 100ms if another key isn't pressed first. This "heartbeat" is used to time pauses and to decide when to display a key's function and when to display NULL. It works, so that this part of the code is definitely being reached. I'll look at it more closely and perhaps compare it with WP43S/C. So far as I remember I used the template from the "example" calculator with minimal modifications, so I hope that the problem won't be too hard to find!

Nigel (UK)


There are issues with the sleeping and waking up using sys_timer. Enquire on the mentioned thread, Dani or Philippe may have specific experience.
Jaco Mostert
Elec Eng, South Africa
C43 (WP34C) on DM42 sn. 03818 & 06199 for complex math, HP42S; HP32Sii, WP34S&C, HP28C, HP35s, EL-506P, EL-W506, PB700; owned FX702P & 11C; used HP67 & HP85; iOS: 42s Byron, Free42, WP31S/34S, HCalc.
User avatar
Jaymos
Posts: 789
Joined: Sun Nov 04, 2018 7:03 pm
Location: Cape Town

Re: WP34S for the DM42

Post by Jaymos »

Jaymos wrote:
Sat Jul 31, 2021 6:37 pm
Nigel (UK) wrote:
Sat Jul 31, 2021 6:31 pm
Jaymos wrote:
Sat Jul 31, 2021 4:11 pm
Nigel,

I did some more testing, this time I took the trouble to measure actual battery consumption, not USB current.

I still cannot paste images or files here, so head over to the message of 2021-07-31 in the link below to see pdfs of the oscillographs, here: https://gitlab.com/Jaymos/wp43c/-/issue ... _640145408
Thank you for this. I had suspected a problem as I've had to replace batteries a couple of times during development, but I wasn't sure whether this was due to the frequent firmware flashing that took place. I recently re-wrote the display code to be less processor-intensive but it seems that this wasn't the problem.

I certainly have a call to sys_sleep() as part of the main loop; immediately before calling this, I start a timer which will wake the system after 100ms if another key isn't pressed first. This "heartbeat" is used to time pauses and to decide when to display a key's function and when to display NULL. It works, so that this part of the code is definitely being reached. I'll look at it more closely and perhaps compare it with WP43S/C. So far as I remember I used the template from the "example" calculator with minimal modifications, so I hope that the problem won't be too hard to find!

Nigel (UK)


There are issues with the sleeping and waking up using sys_timer. Enquire on the mentioned thread, Dani or Philippe may have specific experience.

I can test various options/tries for you this side.
Jaco Mostert
Elec Eng, South Africa
C43 (WP34C) on DM42 sn. 03818 & 06199 for complex math, HP42S; HP32Sii, WP34S&C, HP28C, HP35s, EL-506P, EL-W506, PB700; owned FX702P & 11C; used HP67 & HP85; iOS: 42s Byron, Free42, WP31S/34S, HCalc.
Nigel (UK)
Posts: 67
Joined: Fri Jul 21, 2017 11:08 pm

Re: WP34S for the DM42

Post by Nigel (UK) »

Jaymos wrote:
Sat Jul 31, 2021 6:37 pm
There are issues with the sleeping and waking up using sys_timer. Enquire on the mentioned thread, Dani or Philippe may have specific experience.
Sorry - I missed your earlier reply. I'll read through the thread properly and ask there.

Nigel (UK)
Nigel (UK)
Posts: 67
Joined: Fri Jul 21, 2017 11:08 pm

Re: WP34S for the DM42

Post by Nigel (UK) »

Jaymos wrote:
Sat Jul 31, 2021 6:44 pm
I can test various options/tries for you this side.
I'll take you up on this, if I may. Since I only use the timer when counting down pauses and displaying key functions when a key is held down, I only need it when there is a pause in effect or when a key has been pressed and not yet released. I've changed the code with this in mind. Can you try it when you have time?

You can download the program files (either wp34s.pgm, wp34s_long.pgm, or wp34s_top.pgm) from https://gitlab.com/njdowrick/wp34s-for- ... ter/build/ as usual.

Here's hoping!

Nigel (UK)
Post Reply