Skip to content

Commit

Permalink
NutEmu: Trivial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
shezik committed Jul 16, 2023
1 parent c7172db commit 17fe97c
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 6 deletions.
5 changes: 4 additions & 1 deletion COPYRIGHT-NOTICE-FOR-BINARY-DISTRIBUTION.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,16 @@ limitations under the License.
## GEM
**Note that the relevant code used in this project is a MODIFIED version.**

Modifications on GEM_u8g2.h of spirik/GEM@^1.4.0:
Modifications to GEM_u8g2.h in spirik/GEM@^1.4.0:
Line 134: `virtual void drawMenu();`
Line 141: `protected:`

Modifications to GEMPage.h in spirik/GEM@^1.4.0:
Line 59: `protected:`

Modifications to GEM_u8g2.cpp in spirik/GEM@^1.4.0:
Line 165: `// _u8g2.clear();`

----------------------------------------------------------------

GEM (a.k.a. Good Enough Menu) - Arduino library for creation of graphic multi-level menu with
Expand Down
2 changes: 1 addition & 1 deletion include/NutEmuInterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ class NutEmuInterface {
void setUnlockSpeed(bool);

// Attempt to load deep sleep restore file
bool checkRestoreFlag();
bool readRestoreFlag();
void resetProcessor(bool = false);
void deepSleepPrepare();

Expand Down
6 changes: 3 additions & 3 deletions src/NutEmuInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,7 @@ void NutEmuInterface::handleONKeySequence(uint16_t extraKeycode) {

switchStateOnTick(false, INVALID_KEYCODE, [](bool){ /* Turn off first */
if (context->handleONKeySequenceExtraKeycode == 195 /*y^x on 15C*/) {
printf_log(EMU_TAG "y^x + ON detected, performing magic\n");
context->rotateXReg();
context->switchStateOnTick(true);
} else {
Expand Down Expand Up @@ -400,7 +401,6 @@ void NutEmuInterface::switchStateOnTick(bool targetState, uint16_t extraKeycode,
void NutEmuInterface::rotateXReg() {
uint64_t x_register;
uint64_t rotated_x_register = 0;
printf_log(EMU_TAG "y^x + ON detected, performing magic\n");

nut_read_reg(nv->n, &x_register);
rotated_x_register = (x_register >> 22 | x_register << (WSIZE * 4 - 22)) & ((uint64_t) -1 >> 8);
Expand Down Expand Up @@ -454,8 +454,8 @@ bool NutEmuInterface::saveState(char *filepath) {
file.write((uint8_t *) nv->ram, sizeof(reg_t) * nv->max_ram);
file.write( nv->pf_addr);
file.write( nv->selprf);
file.write((uint8_t *) &nv->cycle_count, sizeof(uint64_t));
// file.write((uint8_t *) nv->display_segments, sizeof(uint32_t) * MAX_DIGIT_POSITION); // Generated using RAM contents (if you call event_restore_completed tho)
file.write((uint8_t *) &nv->cycle_count, sizeof(uint64_t)); // ?
file.write((uint8_t) nv->display_chip->enable);
file.write((uint8_t) nv->display_chip->blink);

Expand Down Expand Up @@ -591,7 +591,7 @@ void NutEmuInterface::setUnlockSpeed(bool unlockSpeed_) {
unlockSpeed = unlockSpeed_;
}

bool NutEmuInterface::checkRestoreFlag() {
bool NutEmuInterface::readRestoreFlag() {
if (!LittleFS.exists(RESTORE_FLAG_FILENAME))
return false;

Expand Down
2 changes: 1 addition & 1 deletion src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ void setup() {
keyboardMgr.init(); // Init and start matrix keyboard scanner task
nutEmuInterface.init();

bool isRestoreFlagPresent = nutEmuInterface.checkRestoreFlag();
bool isRestoreFlagPresent = nutEmuInterface.readRestoreFlag();
printf("Restore flag presence: %d\n", isRestoreFlagPresent);
if (isRestoreFlagPresent) {
nutEmuInterface.resume();
Expand Down

0 comments on commit 17fe97c

Please sign in to comment.