User Tools

Site Tools


commands:extra

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
commands:extra [2024/12/18 19:27] – add shortcut information brandoncommands:extra [2026/05/31 04:37] (current) – change the version requirement text for shortcut brandon
Line 1: Line 1:
 ====== Command:EXTRA (EX) ====== ====== Command:EXTRA (EX) ======
 +
 +-->MS2000 and RM2000 Syntax ^
 +
 +^Shortcut | EX <wrap lo>//requires v9.53//</wrap> |
 +^Format  |EXTRA [X?] [Y?] [Z=lock_ki] [M=button_code] [R=small_enc] [T?] |
 +^Remembered |Using SS Z |
 +
 +<--
  
 --> Tiger Syntax ^ --> Tiger Syntax ^
  
-^Shortcut | EX <wrap lo>//version 9.51//</wrap> | +^Shortcut | EX <wrap lo>//requires v3.51 (Tiger Comm)//</wrap> | 
-^Format  |[Addr#]EXTRA [X?] [Y?] [Z=lock_ki] [M?] |+^Format  |[Addr#]EXTRA [X?] [Y?] [Z=lock_ki] [M=button_code] [R=small_enc] [T?] |
 ^Type |Card-Addressed| ^Type |Card-Addressed|
 ^Remembered |Using [Addr#]SS Z | ^Remembered |Using [Addr#]SS Z |
Line 10: Line 18:
 <-- <--
  
--->MS2000 and RM2000 Syntax ^ 
- 
-^Shortcut | EX <wrap lo>//version 9.53//</wrap> | 
-^Format  |EXTRA [X?] [Y?] [Z=lock_ki] [M?] [M=button_code] | 
-^Remembered |Using SS Z | 
- 
-<-- 
 **X?**  Provides the ''CRISP'' bottom line string as is shown on the LCD display. **X?**  Provides the ''CRISP'' bottom line string as is shown on the LCD display.
  
Line 29: Line 30:
 </WRAP> </WRAP>
  
-**T?:** The controller detects the resolution of the ADC during initialization. (''MS2000 9.2p'' and ''Tiger v3.42'') +<wrap lo>MS-2000 9.2p or Tiger v3.42 required</wrap> \\ 
-  * 0 => 10-bit ADC (''C8051F122'' CPU) +**T?:** The controller detects the resolution of the ADC during initialization.
-  * 1 => 12-bit ADC (''C8051F120'' CPU) +
-   +
-**M?** Returns the ''button_flag_byte'' and resets the value to ''0''. (''MS2000 9.2n'' and ''Tiger v3.36'')+
  
-**M=#** Modify the ''button_flag_byte'' with the button code and call the button functions associated with that code. (''MS2000 9.2p'')+^Code^DAC^CPU^ 
 +| 0 | 10-bit ADC | ''C8051F122'' | 
 +| 1 | 12-bit ADC | ''C8051F120'' | 
 + 
 +<wrap lo>MS-2000 9.2n or Tiger v3.36 required</wrap> \\ 
 +**M?** Returns the ''button_flag_byte'' and resets the value to ''0''. 
 + 
 +**M=#** Modify the ''button_flag_byte'' with the button code and call the button functions associated with that code.
  
 This command differs from [[commands:benable|BE F]] which does not modify the ''button_flag_byte'' and only calls a single button function. This command differs from [[commands:benable|BE F]] which does not modify the ''button_flag_byte'' and only calls a single button function.
Line 58: Line 63:
  
 Each ''2-bit'' section can take on the values ''0-3'', these codes represent the state of the button. Each ''2-bit'' section can take on the values ''0-3'', these codes represent the state of the button.
-^Code   ^Type ^ +^Decimal ^Binary ^State ^ 
-|0 |Not Pressed| +|0 | ''00'' |Not Pressed| 
-|1 |Normal Press| +|1 | ''01'' |Normal Press| 
-|2 |Long Press| +|2 | ''10'' |Long Press| 
-|3 |Extra Long Press|+|3 | ''11'' |Extra Long Press|
  
 Example: Example:
Line 78: Line 83:
   - ''button_flag_byte = 01 11 10 01''   - ''button_flag_byte = 01 11 10 01''
   - ''button_flag_byte = 00 00 00 00'' (''serial command reset'')   - ''button_flag_byte = 00 00 00 00'' (''serial command reset'')
 +
 +<--
  
 \\ \\
---> Example Python code for extracting button states from the button_flag_byte# 
-<code python asibuttonstate.py> 
-# the value returned from EXTRA M? 
-button_flag_byte = 127 
  
-# bit masks +Example Python code for extracting button states from the button_flag_byte:
-mask_at   = 0x03 # 00000011 +
-mask_home = 0x0C # 00001100 +
-mask_js   = 0x30 # 00110000 +
-mask_zero = 0xC0 # 11000000+
  
-# get the button states from button_flag_byte  +{{section>:python_code#parse_button_flag&noheader&nofooter}}
-btn_at   = button_flag_byte & mask_at +
-btn_home = (button_flag_byte & mask_home) >> 2 +
-btn_js   = (button_flag_byte & mask_js) >> 4 +
-btn_zero = (button_flag_byte & mask_zero) >> 6 +
- +
-# show the results in decimal and binary +
-print(f"{button_flag_byte = } (binary {button_flag_byte :08b})") +
-print(f"{btn_at = } (binary {btn_at:02b})") +
-print(f"{btn_home = } (binary {btn_home:02b})") +
-print(f"{btn_js = } (binary {btn_js:02b})") +
-print(f"{btn_zero = } (binary {btn_zero:02b})") +
- +
-# console output: +
-# button_flag_byte = 127 (binary 01111111) +
-# btn_at = 3 (binary 11) +
-# btn_home = 3 (binary 11) +
-# btn_js = 3 (binary 11) +
-# btn_zero = 1 (binary 01) +
-</code> +
-<-- +
- +
-<--+
  
 -->Additional Details About M=button_code ^ -->Additional Details About M=button_code ^
Line 135: Line 112:
 \\ \\
 This demonstrates that button presses are overwritten as if you were interacting with the physical controller pressing buttons. This demonstrates that button presses are overwritten as if you were interacting with the physical controller pressing buttons.
-\\ 
---> Example Python code for creating a button_code # 
-<code python asibuttoncode.py> 
-def create_button_code(at: int = 0, home: int = 0, joystick: int = 0, zero_halt: int = 0) -> int: 
-    assert at in range(4), "Must be in the range 0-3." 
-    assert home in range(4), "Must be in the range 0-3." 
-    assert joystick in range(4), "Must be in the range 0-3." 
-    assert zero_halt == 0 or zero_halt == 1, "Must be 0 or 1." 
  
-    button_code = 0+<--
  
-    # bit masks +Example Python code for creating a button_flag_byte:
-    BITMASK_AT   = 0x03 # 00000011 +
-    BITMASK_HOME = 0x0C # 00001100 +
-    BITMASK_JS   = 0x30 # 00110000 +
-    BITMASK_ZERO = 0xC0 # 11000000+
  
-    # set bits +{{section>:python_code#create_button_flag&noheader&nofooter}}
-    button_code &= ~BITMASK_AT +
-    button_code |= at & BITMASK_AT +
- +
-    button_code &= ~BITMASK_HOME +
-    button_code |= (home << 2) & BITMASK_HOME +
- +
-    button_code &= ~BITMASK_JS +
-    button_code |= (joystick << 4) & BITMASK_JS +
- +
-    button_code &= ~BITMASK_ZERO +
-    button_code |= (zero_halt << 6) & BITMASK_ZERO +
- +
-    return button_code +
- +
-def main(): +
-    button_code = create_button_code(at=1, home=1) +
-    print(button_code) +
-    # prints 5 +
-     +
-if __name__ == "__main__": +
-    main() +
-      +
-</code> +
-<-- +
- +
-<--+
  
 {{tag>commands tiger ms2000 crisp}} {{tag>commands tiger ms2000 crisp}}
Address: 29391 W Enid Rd. Eugene, OR 97402, USA | Phone: +1 (541) 461-8181
commands/extra.1734568049.txt.gz · Last modified: by brandon