This repository has been archived by the owner on Dec 8, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #69 from jeff-winn/develop
Merging develop into master
- Loading branch information
Showing
86 changed files
with
2,328 additions
and
1,364 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"recommendations": [ | ||
"vsciot-vscode.vscode-arduino", | ||
"ms-vscode.cpptools" | ||
] | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,44 @@ | ||
#include <Arduino.h> | ||
#include "src/App.h" | ||
#include "src/Button.h" | ||
#include "src/Log.h" | ||
#include "src/Mainboard.h" | ||
|
||
// Defines the driver which controls the flywheel motors. | ||
DualG2HighPowerMotorShield18v18 flywheelDriver(9, -1, 5, -1, A0, 10, -1, 6, -1, A1); | ||
const uint16_t CLEAR_HOLD_IN_MSECS = 30000; // 30 seconds | ||
const uint16_t RESET_HOLD_IN_MSECS = 5000; // 5 seconds | ||
const uint32_t RESET_BUTTON_PIN = 28; | ||
|
||
// Defines the driver which controls the belt feed motor. | ||
G2HighPowerMotorShield18v17 beltDriver(17, -1, 11, -1, A2); | ||
|
||
// Defines the driver for the onboard bluetooth module. | ||
Adafruit_BluefruitLE_SPI bluetoothDriver(8, 7, 4); | ||
|
||
// Defines the FRAM module for persistent data storage. | ||
Adafruit_FRAM_I2C fram; | ||
|
||
ConfigurationSettings config(&fram); | ||
Mainboard mainboard; | ||
|
||
App* app; | ||
Button ResetButton = Button(RESET_BUTTON_PIN, true); | ||
|
||
void setup() { | ||
app = new App( | ||
new FlywheelController( | ||
&mainboard, &flywheelDriver, &config), | ||
new FeedController( | ||
&mainboard, &beltDriver, &config), | ||
new Button( | ||
new DigitalPin(13, &mainboard)), | ||
new Button( | ||
new DigitalPin(12, &mainboard)), | ||
new Button( | ||
new DigitalPin(18, &mainboard), true), | ||
new BluetoothManager( | ||
&bluetoothDriver), | ||
&config, | ||
&mainboard | ||
); | ||
|
||
app->init(); | ||
Log.waitForUsbConnection(); | ||
|
||
ResetButton.init(); | ||
Application.init(); | ||
} | ||
|
||
void loop() { | ||
app->run(); | ||
if (ResetButton.isPressed()) { | ||
handleResetAttempt(); | ||
} | ||
else { | ||
Application.run(); | ||
} | ||
} | ||
|
||
void handleResetAttempt() { | ||
auto started = millis(); | ||
while (ResetButton.isPressed()) { | ||
MCU.delaySafe(50); | ||
} | ||
|
||
auto successful = false; | ||
auto diff = millis() - started; | ||
|
||
if (diff >= CLEAR_HOLD_IN_MSECS) { | ||
Application.clear(); | ||
} | ||
else if (diff >= RESET_HOLD_IN_MSECS) { | ||
Application.reset(); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.