Skip to content

Commit

Permalink
factor in startup delay in swing on delay for BC prop
Browse files Browse the repository at this point in the history
  • Loading branch information
profezzorn committed Aug 31, 2021
1 parent 125cbd2 commit e3242e6
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 16 deletions.
31 changes: 16 additions & 15 deletions ProffieOS.ino
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,22 @@ uint64_t loop_cycles = 0;

#define NELEM(X) (sizeof(X)/sizeof((X)[0]))

#ifdef DOSFS_CONFIG_STARTUP_DELAY
#define PROFFIEOS_SD_STARTUP_DELAY DOSFS_CONFIG_STARTUP_DELAY
#else
#define PROFFIEOS_SD_STARTUP_DELAY 1000
#endif

#ifndef CONFIG_STARTUP_DELAY
#define CONFIG_STARTUP_DELAY 0
#endif

#if PROFFIEOS_SD_STARTUP_DELAY > CONFIG_STARTUP_DELAY
#define PROFFIEOS_STARTUP_DELAY PROFFIEOS_SD_STARTUP_DELAY
#else
#define PROFFIEOS_STARTUP_DELAY CONFIG_STARTUP_DELAY
#endif

#include "common/linked_list.h"
#include "common/looper.h"
#include "common/command_parser.h"
Expand Down Expand Up @@ -1709,21 +1725,6 @@ void setup() {
// Wait for all voltages to settle.
// Accumulate some entrypy while we wait.
uint32_t now = millis();
#ifdef DOSFS_CONFIG_STARTUP_DELAY
#define PROFFIEOS_SD_STARTUP_DELAY DOSFS_CONFIG_STARTUP_DELAY
#else
#define PROFFIEOS_SD_STARTUP_DELAY 1000
#endif

#ifndef CONFIG_STARTUP_DELAY
#define CONFIG_STARTUP_DELAY 0
#endif

#if PROFFIEOS_SD_STARTUP_DELAY > CONFIG_STARTUP_DELAY
#define PROFFIEOS_STARTUP_DELAY PROFFIEOS_SD_STARTUP_DELAY
#else
#define PROFFIEOS_STARTUP_DELAY CONFIG_STARTUP_DELAY
#endif

while (millis() - now < PROFFIEOS_STARTUP_DELAY) {
#ifndef NO_BATTERY_MONITOR
Expand Down
2 changes: 1 addition & 1 deletion props/saber_BC_buttons.h
Original file line number Diff line number Diff line change
Expand Up @@ -545,7 +545,7 @@ class SaberBCButtons : public PROP_INHERIT_PREFIX PropBase {
#endif
// Due to motion chip startup on boot creating false ignition
// we delay Swing On at boot for 3000ms
if (millis() > 3000) {
if (millis() > (PROFFIEOS_STARTUP_DELAY + 3000)) {
FastOn();
#ifdef BC_GESTURE_AUTO_BATTLE_MODE
STDOUT.println("Entering Battle Mode");
Expand Down

0 comments on commit e3242e6

Please sign in to comment.