Started massive re-factor and re-write of code base -- VERY BROKEN
This commit is contained in:
parent
3c3c1faaf0
commit
6a242a25c1
|
@ -22,11 +22,6 @@
|
||||||
// Don't change anything below here
|
// Don't change anything below here
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
// Standard colors
|
|
||||||
#define BACKGROUND BLACK
|
|
||||||
#define TEXT GRAY
|
|
||||||
#define HILIGHT GOLD
|
|
||||||
|
|
||||||
// Serial modes supported
|
// Serial modes supported
|
||||||
// Abused in for loops / lookup tables -- DO NOT CHANGE none or set values
|
// Abused in for loops / lookup tables -- DO NOT CHANGE none or set values
|
||||||
enum serialmode {
|
enum serialmode {
|
||||||
|
|
|
@ -7,4 +7,4 @@
|
||||||
use this code however you'd like, just keep this license and
|
use this code however you'd like, just keep this license and
|
||||||
attribute.
|
attribute.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -8,3 +8,17 @@
|
||||||
attribute.
|
attribute.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
UI State machine (current element = config / stats / inline display of data)
|
||||||
|
Configuration state machine (speed, pinout, logic level, sd card on/off, boot logo on/off)
|
||||||
|
Message to config (element + new value)
|
||||||
|
Message to UI (element + success/fail)
|
||||||
|
|
||||||
|
// Button's controlling UI
|
||||||
|
UIButton* okButton = new UIButton(22, 23);
|
||||||
|
UIButton* cancelButton = new UIButton(24, 25);
|
||||||
|
|
||||||
|
// Select / Enter
|
||||||
|
if (okButton->isPressed()) {
|
||||||
|
//FIXME: Re-enable once new LCD is online
|
||||||
|
//setMode(selectedMode);
|
||||||
|
}
|
|
@ -8,3 +8,44 @@
|
||||||
attribute.
|
attribute.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// PSP joystick tracking
|
||||||
|
long pspUpCount = 0; // Used to slow down how fast we repeat up movement
|
||||||
|
long pspDownCount = 0; // Used to slow down how fast we repeat down movement
|
||||||
|
int pspXAxisValue;
|
||||||
|
int pspYAxisValue;
|
||||||
|
|
||||||
|
// Read the x/y values from the joystick
|
||||||
|
pspXAxisValue=map(analogRead(pspXPin), 0, 1023, 0, 10);
|
||||||
|
pspYAxisValue=map(analogRead(pspYPin), 0, 1023, 0, 10);
|
||||||
|
|
||||||
|
// Move cursor Up
|
||||||
|
if (pspYAxisValue > 6 ) {
|
||||||
|
pspUpCount++;
|
||||||
|
if (pspUpCount > 768) {
|
||||||
|
pspUpCount = 0;
|
||||||
|
serialmode newMode = (serialmode)(selectedMode - 1);
|
||||||
|
if (newMode >= 0) {
|
||||||
|
//FIXME: Re-enable once new LCD is online
|
||||||
|
//setSelection(newMode);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
pspUpCount = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Move cursor Down
|
||||||
|
if (pspYAxisValue < 4 ) {
|
||||||
|
pspDownCount++;
|
||||||
|
if (pspDownCount > 768) {
|
||||||
|
serialmode newMode = (serialmode)(selectedMode + 1);
|
||||||
|
if (newMode <= modelinespeed) {
|
||||||
|
//FIXME: Re-enable once new LCD is online
|
||||||
|
//setSelection(newMode);
|
||||||
|
}
|
||||||
|
pspDownCount = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
pspDownCount = 0;
|
||||||
|
}
|
|
@ -8,3 +8,7 @@
|
||||||
attribute.
|
attribute.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// Standard colors
|
||||||
|
#define BACKGROUND BLACK
|
||||||
|
#define TEXT GRAY
|
||||||
|
#define HILIGHT GOLD
|
||||||
|
|
|
@ -9,17 +9,6 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "Project.h"
|
#include "Project.h"
|
||||||
#include "UIButton.h"
|
|
||||||
|
|
||||||
// Button's controlling UI
|
|
||||||
UIButton* okButton = new UIButton(22, 23);
|
|
||||||
UIButton* cancelButton = new UIButton(24, 25);
|
|
||||||
|
|
||||||
// PSP joystick tracking
|
|
||||||
long pspUpCount = 0; // Used to slow down how fast we repeat up movement
|
|
||||||
long pspDownCount = 0; // Used to slow down how fast we repeat down movement
|
|
||||||
int pspXAxisValue;
|
|
||||||
int pspYAxisValue;
|
|
||||||
|
|
||||||
// Mode info needed
|
// Mode info needed
|
||||||
serialmode currentMode = none;
|
serialmode currentMode = none;
|
||||||
|
@ -44,49 +33,5 @@ void setup() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void loop() {
|
void loop() {
|
||||||
// Read the x/y values from the joystick
|
|
||||||
pspXAxisValue=map(analogRead(pspXPin), 0, 1023, 0, 10);
|
|
||||||
pspYAxisValue=map(analogRead(pspYPin), 0, 1023, 0, 10);
|
|
||||||
|
|
||||||
// Move cursor Up
|
|
||||||
if (pspYAxisValue > 6 ) {
|
|
||||||
pspUpCount++;
|
|
||||||
if (pspUpCount > 768) {
|
|
||||||
pspUpCount = 0;
|
|
||||||
serialmode newMode = (serialmode)(selectedMode - 1);
|
|
||||||
if (newMode >= 0) {
|
|
||||||
//FIXME: Re-enable once new LCD is online
|
|
||||||
//setSelection(newMode);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
pspUpCount = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Move cursor Down
|
|
||||||
if (pspYAxisValue < 4 ) {
|
|
||||||
pspDownCount++;
|
|
||||||
if (pspDownCount > 768) {
|
|
||||||
serialmode newMode = (serialmode)(selectedMode + 1);
|
|
||||||
if (newMode <= modelinespeed) {
|
|
||||||
//FIXME: Re-enable once new LCD is online
|
|
||||||
//setSelection(newMode);
|
|
||||||
}
|
|
||||||
pspDownCount = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
pspDownCount = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Select / Enter
|
|
||||||
if (okButton->isPressed()) {
|
|
||||||
//FIXME: Re-enable once new LCD is online
|
|
||||||
//setMode(selectedMode);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Reference in a new issue