Skip to content

Adding new info state and screen to splash mode #181

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 9, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions BuildSystem/scripts/build-all.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ rmdir /s /q %RELEASE_DIR%
mkdir %RELEASE_DIR%

rmdir /s /q %BUILD_DIR%
arduino-cli compile -b arduino:avr:nano:cpu=atmega328 -v --build-path %BUILD_DIR% %MAIN_INO%
arduino-cli compile -b arduino:avr:nano:cpu=atmega328 -v --build-path %BUILD_DIR% "build.extra_flags=-DVERSION_MAJOR=9 -DVERSION_MINOR=9 -DVERSION_PATCH=9" %MAIN_INO%
move %BUILD_DIR%\MaxMix.ino.hex %RELEASE_DIR%\MaxMix.ino.hex

rmdir /s /q %BUILD_DIR%
arduino-cli compile -b arduino:avr:nano:cpu=atmega328 -v --build-path %BUILD_DIR% --build-properties build.extra_flags=-DHALF_STEP %MAIN_INO%
arduino-cli compile -b arduino:avr:nano:cpu=atmega328 -v --build-path %BUILD_DIR% --build-properties "build.extra_flags=-DHALF_STEP -DVERSION_MAJOR=9 -DVERSION_MINOR=9 -DVERSION_PATCH=9" %MAIN_INO%
move %BUILD_DIR%\MaxMix.ino.hex %RELEASE_DIR%\MaxMix.halfstep.ino.hex

rmdir /s /q %BUILD_DIR%
Expand Down
22 changes: 22 additions & 0 deletions Embedded/MaxMix/Config.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,22 @@
#include "src/FixedPoints/FixedPoints.h"
#include "src/FixedPoints/FixedPointsCommon.h"

//********************************************************
// *** DEFINES
//********************************************************
#ifndef VERSION_MAJOR
#define VERSION_MAJOR 0
#endif

#ifndef VERSION_MINOR
#define VERSION_MINOR 0
#endif

#ifndef VERSION_PATCH
#define VERSION_PATCH 0
#endif


//********************************************************
// *** CONSTS
//********************************************************
Expand All @@ -27,11 +43,17 @@ static const uint8_t PIN_ENCODER_OUTB = 16; //A2
static const uint8_t PIN_ENCODER_SWITCH = 17; //A3

// --- States
static const uint8_t MODE_SPLASH = 255;

static const uint8_t MODE_OUTPUT = 0;
static const uint8_t MODE_APPLICATION = 1;
static const uint8_t MODE_GAME = 2;
static const uint8_t MODE_COUNT = 3;

static const uint8_t STATE_SPLASH_LOGO = 0;
static const uint8_t STATE_SPLASH_INFO = 1;
static const uint8_t STATE_SPLASH_COUNT = 2;

static const uint8_t STATE_OUTPUT_NAVIGATE = 0;
static const uint8_t STATE_OUTPUT_EDIT = 1;
static const uint8_t STATE_OUTPUT_COUNT = 2;
Expand Down
28 changes: 26 additions & 2 deletions Embedded/MaxMix/Display.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ namespace Display
}

//---------------------------------------------------------
// MaxMix Logo Screen
// MaxMix Logo screen
//---------------------------------------------------------
void SplashScreen(void)
{
Expand All @@ -205,6 +205,30 @@ namespace Display
display.display();
}

//---------------------------------------------------------
// Firmware Version screen
//---------------------------------------------------------
void InfoScreen(void)
{
display.clearDisplay();

display.setTextColor(WHITE);
display.setTextSize(1);

display.setCursor(0, (DISPLAY_HEIGHT / 2) - DISPLAY_CHAR_HEIGHT_X1);
display.print("FW: ");
display.print(VERSION_MAJOR);
display.print(".");
display.print(VERSION_MINOR);
display.print(".");
display.print(VERSION_PATCH);

display.setCursor(0, (DISPLAY_HEIGHT / 2) + DISPLAY_CHAR_SPACING_X2);
display.print("Built " __DATE__);

display.display();
}

//---------------------------------------------------------
// Output Mode screens
//---------------------------------------------------------
Expand Down Expand Up @@ -288,4 +312,4 @@ namespace Display

display.display();
}
}; // namespace Display
}; // namespace Display
1 change: 1 addition & 0 deletions Embedded/MaxMix/Display.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ namespace Display
void Sleep(void);

void SplashScreen(void);
void InfoScreen(void);

void OutputSelectScreen(Item* item, bool isDefaultEndpoint, uint8_t leftArrow, uint8_t rightArrow, uint8_t modeIndex);
void OutputEditScreen(Item* item, uint8_t modeIndex);
Expand Down
39 changes: 29 additions & 10 deletions Embedded/MaxMix/MaxMix.ino
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ uint8_t sendBuffer[SEND_BUFFER_SIZE];
uint8_t encodeBuffer[SEND_BUFFER_SIZE];

// State
uint8_t mode = MODE_OUTPUT;
uint8_t mode = MODE_SPLASH;
uint8_t stateSplash = STATE_SPLASH_LOGO;
uint8_t stateOutput = STATE_OUTPUT_EDIT;
uint8_t stateApplication = STATE_APPLICATION_NAVIGATE;
uint8_t stateGame = STATE_GAME_SELECT_A;
Expand Down Expand Up @@ -198,7 +199,8 @@ void ClearSend()
//---------------------------------------------------------
void ResetState()
{
mode = MODE_OUTPUT;
mode = MODE_SPLASH;
stateSplash = STATE_SPLASH_LOGO;
stateOutput = STATE_OUTPUT_EDIT;
stateApplication = STATE_APPLICATION_NAVIGATE;
stateGame = STATE_GAME_SELECT_A;
Expand Down Expand Up @@ -227,6 +229,12 @@ bool ProcessPackage()
}
else if(command == MSG_COMMAND_ADD)
{

if(mode == MODE_SPLASH)
{
mode = MODE_OUTPUT;
}

uint32_t id = GetIdFromPackage(decodeBuffer);
bool isDevice = GetIsDeviceFromAddPackage(decodeBuffer);

Expand Down Expand Up @@ -504,9 +512,15 @@ bool ProcessEncoderButton()
if(encoderButton.tapped())
{
if(stateDisplay == STATE_DISPLAY_SLEEP)
{
return true;

if(mode == MODE_OUTPUT)
}
else if(mode == MODE_SPLASH)
{
stateSplash = CycleState(stateSplash, STATE_SPLASH_COUNT);
Display::ResetTimers();
}
else if(mode == MODE_OUTPUT)
{
if(stateOutput == STATE_OUTPUT_NAVIGATE)
SendSetDefaultEndpointCommand(&devices[itemIndexOutput], sendBuffer, encodeBuffer);
Expand Down Expand Up @@ -625,13 +639,18 @@ void UpdateDisplay()
}

// TODO: Update to include devices.
if(sessionCount == 0)
if(mode == MODE_SPLASH)
{
Display::SplashScreen();
return;
}

if(mode == MODE_OUTPUT)
if(stateSplash == STATE_SPLASH_LOGO)
{
Display::SplashScreen();
}
else if(stateSplash == STATE_SPLASH_INFO)
{
Display::InfoScreen();
}
}
else if(mode == MODE_OUTPUT)
{
if(stateOutput == STATE_OUTPUT_NAVIGATE)
{
Expand Down
2 changes: 1 addition & 1 deletion Embedded/MaxMix/platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ include_dir = src
platform = atmelavr
board = nanoatmega328
framework = arduino
upload_port = COM5
upload_port = COM15