You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This commit wraps up a number of changes that aim to improve the trade
process, its robustness, add some features, and fix some bugs.
Change list in rough order of importance:
More robust logic during trading which more correctly syncs states
between the Flipper and gameboy.
Fixes#20 as a side effect.
Implement trade patch list. This allows for the Flipper to both send and
receive patch data.
Fixes#18
Ability for the Flipper to correctly receive the Pokemon traded to it
and put that Pokemon in the Flipper's trade buffer. This allows for
trading back and forth, as well as the following feature.
Ability for the Flipper to back out of the trade menu, modify the
current Pokemon, and re-enter the trade menu without having to
completely reset the Gameboy and re-enter the Cable Club.
Fixes#19
Completely isolate Trade's context and scope. The _alloc() function now
sets itself up with a View and adds it to the app's view_dispatcher.
Then returns an anonymous pointer to the Trade context.
Adds a huge comment block in the trade source outlining the current
understanding of the actual trade data protocol. Also adds specific
comments for more context specific details through various trade states.
Sets up draw timer callback on 250 ms intervals. This callback toggles a
variable that is used to switch between the two screens during the
TRADING state. The actual draw callback may be called more often. Using
a timer and variable modification allows us exact control of screen
changes.
Clean up overall state tracking. There are now two states that are
tracked, the Gameboy/link state, and the actual trade states. This also
allows elimination of additional bools that were used for state tracking
in parallel. State transitions and meanings should now be a bit more
straightforward.
CLK pin now implements an interrupt on either edge. The ISR was updated
to shift data out on the falling edge, and read data in on the rising
edge. This eliminates delays while in an interrupt context as well as
mimics Gameboy behavior by matching the setup/hold times.
Remove use of magic numbers as much as possible. Bytes to/from the
Pokemon game now use macros for most of the bytes. Many of these were
pulled from https://github.com/pret/pokered defines.
Clean up cycle counter to real-time maths. Copied general paradigms from
Flipper onewire code. This also includes the bit counter timeout and now
ensures correct timeouts are measured between transmitted bytes.
0 commit comments