Fix MAVAI vendor calculation and optimize UI for small screens #20
+44
−117
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Proposed Changes
Fixes critical vendor display bug and optimizes all UI screens for M5StickC Plus (135×240 pixels).
Critical Bugs Fixed:
exportVendor()was extracting UPPER 16 bits with +1, now correctly extracts LOW 16 bits without +1 per MIKAI specdaysDifference()return type changed fromuint16_ttouint32_tto prevent overflow in BCD calculationsUI Optimization for Small Screens:
"Production:"→"Prod:","Encryption Key:"→"EncKey:""Lock: OK | Status: ACTIVE"on single lineshow_mykey_info()reset_key_ui()from double to single confirmation dialogset_state(IDLE_MODE)callsCode Example - Vendor Calculation Fix:
Impact:
Types of Changes
Verification
resetKey()with dates beyond 2174 (validates uint32_t fix)Testing
Linked Issues
Problem statement addressed issues with incomplete
resetKey()(already complete), vendor calculation bugs, and UI not fitting on small screens.User-Facing Change
Further Comments
The
resetKey()implementation was already complete in the codebase, processing all 38 blocks (0x10-0x56) correctly. Header constantsMYKEY_VENDOR_DEFAULT_HIGH/LOWwere also already present. Main work was fixing the vendor calculation bug and optimizing UI density.Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
collector.platformio.org/home/REDACTED/.local/bin/pio pio run -e m5stack-cplus2(dns block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
Problem Statement
The MAVAI Tool has several critical issues that need to be fixed:
1. Incomplete
resetKey()ImplementationThe current
resetKey()function is too simplified and doesn't match the originalMyKeyReset()logic from MIKAI library.Current implementation only resets:
Required implementation (from MyKeyReset()):
The original
MyKeyReset()processes 38 specific blocks (0x10 to 0x56) with different logic for each block type: