From 2966b16920826c5c3f3a8143ea20e3a01aa77750 Mon Sep 17 00:00:00 2001
From: Jake Read <jake.read@cba.mit.edu>
Date: Tue, 1 Feb 2022 20:19:47 -0500
Subject: [PATCH] home in bus interrupt

---
 firmware/stepper-drop/src/main.cpp  | 10 ++++++----
 firmware/stepper-drop/src/osape-d51 |  2 +-
 2 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/firmware/stepper-drop/src/main.cpp b/firmware/stepper-drop/src/main.cpp
index be9ee3b..706fc85 100644
--- a/firmware/stepper-drop/src/main.cpp
+++ b/firmware/stepper-drop/src/main.cpp
@@ -119,8 +119,6 @@ void loop() {
   osapLoop();
   stepper_hw->dacRefresh();
   limitHit() ? ERRLIGHT_ON : ERRLIGHT_OFF;
-  // home statemachine 
-  if(getHomeState() != HOMESTATE_NONE) runHomingRoutine();
 } // end loop 
 
 // -------------------------------------------------------- BUS INTERRUPT / STEP 
@@ -138,10 +136,14 @@ void ucBusDrop_onPacketARx(uint8_t* inBufferA, volatile uint16_t len){
 }
 
 void ucBusDrop_onRxISR(void){
+  // if we're currently homing the motor, bail 
+  // home statemachine 
+  if(getHomeState() != HOMESTATE_NONE){
+    runHomingRoutine();
+    return;
+  }
     // if we dont' have valid steps, bail 
   if(!stepValid) return;
-  // if we're currently homing the motor, bail 
-  if(getHomeState() != HOMESTATE_NONE) return;
   // extract our step mask
   stepMask = 0b00000011 & (stepCache[cachePtr] >> (axisPick * 2));
   // mask -> step api:
diff --git a/firmware/stepper-drop/src/osape-d51 b/firmware/stepper-drop/src/osape-d51
index 53c513f..f33baa5 160000
--- a/firmware/stepper-drop/src/osape-d51
+++ b/firmware/stepper-drop/src/osape-d51
@@ -1 +1 @@
-Subproject commit 53c513f461e43ac61d13d0111127b3f174fef466
+Subproject commit f33baa5ff96067f3474518abdd5f7d44712c6121
-- 
GitLab