Skip to content

Commit

Permalink
fix build
Browse files Browse the repository at this point in the history
  • Loading branch information
AJ-Koenig committed Dec 16, 2024
1 parent c5fc30c commit 8e1f554
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 60 deletions.
39 changes: 35 additions & 4 deletions Software/src/ossm/OSSM.SimplePenetration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,40 @@ void OSSM::startSimplePenetrationTask(void *pvParameters) {
void OSSM::startSimplePenetration() {
int stackSize = 30 * configMINIMAL_STACK_SIZE;

xTaskCreatePinnedToCore(startSimplePenetrationTask,
"startSimplePenetrationTask", stackSize, this,
configMAX_PRIORITIES - 1,
&Tasks::runSimplePenetrationTaskH,
xTaskCreatePinnedToCore(
startSimplePenetrationTask, "startSimplePenetrationTask", stackSize,
this, configMAX_PRIORITIES - 1, &Tasks::runSimplePenetrationTaskH,
Tasks::operationTaskCore);
}

void startStreamingTask(void *pvParameters) {
OSSM *ossm = (OSSM *)pvParameters;

auto isInCorrectState = [](OSSM *ossm) {
// Add any states that you want to support here.
// return ossm->sm->is("streaming"_s) ||
// ossm->sm->is("streaming.preflight"_s) ||
// ossm->sm->is("streaming.idle"_s);
return true;
};

// create a function that, given a time, returns a value between 0 and 100
// from a sine wave with period of 1000ms
auto sineWave = [](int time) { return sin(time * 2 * M_PI / 1000) * 100; };

while (isInCorrectState(ossm)) {
ossm->stepper->moveTo(sineWave(millis()), false);
vTaskDelay(1);
}

vTaskDelete(nullptr);
}

void OSSM::startStreaming() {
int stackSize = 10 * configMINIMAL_STACK_SIZE;

xTaskCreatePinnedToCore(startStreamingTask, "startStreamingTask",
stackSize,
this, configMAX_PRIORITIES - 1, nullptr,
Tasks::operationTaskCore);
}
37 changes: 0 additions & 37 deletions Software/src/ossm/OSSM.Streaming.cpp

This file was deleted.

38 changes: 19 additions & 19 deletions Software/src/ossm/OSSM.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ class OSSM : public OSSMInterface {
o.startSimplePenetration();
};

// auto startStreaming = [](OSSM &o) { o.startStreaming(); };
auto startStreaming = [](OSSM &o) { o.startStreaming(); };

auto startStrokeEngine = [](OSSM &o) { o.startStrokeEngine(); };
auto emergencyStop = [](OSSM &o) {
Expand Down Expand Up @@ -185,11 +185,12 @@ class OSSM : public OSSMInterface {
"homing.backward"_s + done[isFirstHomed] / setHomed = "menu"_s,
"homing.backward"_s + done[(isOption(Menu::SimplePenetration))] / setHomed = "simplePenetration"_s,
"homing.backward"_s + done[(isOption(Menu::StrokeEngine))] / setHomed = "strokeEngine"_s,
// "homing.backward"_s + done[(isOption(Menu::Streaming))] / setHomed = "streaming"_s,
"homing.backward"_s + done[(isOption(Menu::Streaming))] / setHomed = "streaming"_s,

"menu"_s / (drawMenu, startWifi) = "menu.idle"_s,
"menu.idle"_s + buttonPress[(isOption(Menu::SimplePenetration))] = "simplePenetration"_s,
"menu.idle"_s + buttonPress[(isOption(Menu::StrokeEngine))] = "strokeEngine"_s,
"menu.idle"_s + buttonPress[(isOption(Menu::Streaming))] = "streaming"_s,
"menu.idle"_s + buttonPress[(isOption(Menu::UpdateOSSM))] = "update"_s,
"menu.idle"_s + buttonPress[(isOption(Menu::WiFiSetup))] = "wifi"_s,
"menu.idle"_s + buttonPress[isOption(Menu::Help)] = "help"_s,
Expand All @@ -201,11 +202,11 @@ class OSSM : public OSSMInterface {
"simplePenetration.preflight"_s + done / (resetSettings, drawPlayControls, startSimplePenetration) = "simplePenetration.idle"_s,
"simplePenetration.idle"_s + longPress / (emergencyStop, setNotHomed) = "menu"_s,

// "streaming"_s [isNotHomed] = "homing"_s,
// "streaming"_s [isPreflightSafe] / (resetSettings, drawPlayControls, startStreaming) = "streaming.idle"_s,
// "streaming"_s / drawPreflight = "streaming.preflight"_s,
// "streaming.preflight"_s + done / (resetSettings, drawPlayControls, startStreaming) = "streaming.idle"_s,
// "streaming.idle"_s + longPress / (emergencyStop, setNotHomed) = "menu"_s,
"streaming"_s [isNotHomed] = "homing"_s,
"streaming"_s [isPreflightSafe] / (resetSettings, drawPlayControls, startStreaming) = "streaming.idle"_s,
"streaming"_s / drawPreflight = "streaming.preflight"_s,
"streaming.preflight"_s + done / (resetSettings, drawPlayControls, startStreaming) = "streaming.idle"_s,
"streaming.idle"_s + longPress / (emergencyStop, setNotHomed) = "menu"_s,


"strokeEngine"_s [isNotHomed] = "homing"_s,
Expand Down Expand Up @@ -243,18 +244,6 @@ class OSSM : public OSSMInterface {
}
};

/**
* ///////////////////////////////////////////
* ////
* //// Private Objects and Services
* ////
* ///////////////////////////////////////////
*/
FastAccelStepper *stepper;
U8G2_SSD1306_128X64_NONAME_F_HW_I2C &display;
StateLogger logger;
AiEsp32RotaryEncoder &encoder;

/**
* ///////////////////////////////////////////
* ////
Expand Down Expand Up @@ -354,6 +343,17 @@ class OSSM : public OSSMInterface {
sml::logger<StateLogger>>>
sm = nullptr; // The state machine

/**
* ///////////////////////////////////////////
* ////
* //// Objects and Services
* ////
* ///////////////////////////////////////////
*/
FastAccelStepper *stepper;
U8G2_SSD1306_128X64_NONAME_F_HW_I2C &display;
StateLogger logger;
AiEsp32RotaryEncoder &encoder;
WiFiManager wm;

// Implement the interface methods
Expand Down

0 comments on commit 8e1f554

Please sign in to comment.