From 437d197c3b03de5e49b9adfd79704f9a27f00656 Mon Sep 17 00:00:00 2001
From: Jake Read <jake.read@cba.mit.edu>
Date: Tue, 11 Jan 2022 16:46:12 -0500
Subject: [PATCH] invert!

---
 circuit/2021-06_fab-step-ucbus/eagle.epf | 8 ++++----
 circuit/2021-12_fab-step-cl/eagle.epf    | 4 ++--
 firmware/fab-step/src/main.cpp           | 8 +++++++-
 log/fab-step-log.md                      | 9 +++++++--
 4 files changed, 20 insertions(+), 9 deletions(-)

diff --git a/circuit/2021-06_fab-step-ucbus/eagle.epf b/circuit/2021-06_fab-step-ucbus/eagle.epf
index aaa40d9..98fdb8c 100644
--- a/circuit/2021-06_fab-step-ucbus/eagle.epf
+++ b/circuit/2021-06_fab-step-ucbus/eagle.epf
@@ -72,7 +72,7 @@ Package="8-MSOP-FAB"
 Type="Board Editor"
 Number=2
 File="fab-step-ucbus.brd"
-View="5.46577 -7.35987 53.2628 45.1766"
+View="15.3672 -9.80361 55.198 33.9768"
 WireWidths=" 0.1016 0.127 0.2 1.016 1.27 2.54 0.15 0.0762 0.4064 0.254 0.508 0.6096 0.8128 0.1524 0.2032 0.3048"
 PadDiameters=" 0.254 0.3048 0.4064 0.6096 0.8128 1.016 1.27 1.4224 1.6764 1.778 1.9304 2.1844 2.54 3.81 6.4516 0"
 PadDrills=" 0.2 0.25 0.3 0.35 0.4 0.45 0.5 0.55 0.65 0.7 0.75 0.8 0.85 0.9 1 0.6"
@@ -116,7 +116,7 @@ Layer=1
 Type="Schematic Editor"
 Number=1
 File="fab-step-ucbus.sch"
-View="-45.6318 -41.6491 418.164 207.16"
+View="83.7509 2.30664 239.075 85.6323"
 WireWidths=" 0.0762 0.1016 0.127 0.15 0.2 0.2032 0.254 0.3048 0.4064 0.508 0.6096 0.8128 1.016 1.27 2.54 0.1524"
 PadDiameters=" 0.254 0.3048 0.4064 0.6096 0.8128 1.016 1.27 1.4224 1.6764 1.778 1.9304 2.1844 2.54 3.81 6.4516 0"
 PadDrills=" 0.2 0.25 0.3 0.35 0.4 0.45 0.5 0.55 0.65 0.7 0.75 0.8 0.85 0.9 1 0.6"
@@ -155,7 +155,7 @@ ArcDirection=0
 AddLevel=2
 PadsSameType=0
 Layer=91
-Views=" 1: -45.6318 -41.6491 418.164 207.16"
+Views=" 1: 83.7509 2.30664 239.075 85.6323"
 Sheet="1"
 
 [Win_4]
@@ -163,7 +163,7 @@ Type="Control Panel"
 Number=0
 
 [Desktop]
-Screen="1920 1080"
+Screen="3171 2520"
 Window="Win_1"
 Window="Win_2"
 Window="Win_3"
diff --git a/circuit/2021-12_fab-step-cl/eagle.epf b/circuit/2021-12_fab-step-cl/eagle.epf
index 6e9afd3..fc0768f 100644
--- a/circuit/2021-12_fab-step-cl/eagle.epf
+++ b/circuit/2021-12_fab-step-cl/eagle.epf
@@ -73,7 +73,7 @@ Sheet="1"
 Type="Board Editor"
 Number=2
 File="fab-step-cl.brd"
-View="6.73721 19.6027 34.3972 48.5169"
+View="8.79415 -3.43188 66.1499 56.5246"
 WireWidths=" 0.127 0.2 1.016 1.27 2.54 0.15 0.0762 0.8128 0 0.254 0.2032 0.3048 0.4064 0.508 0.6096 0.1524"
 PadDiameters=" 0.254 0.3048 0.4064 0.6096 0.8128 1.016 1.27 1.4224 1.6764 1.778 1.9304 2.1844 2.54 3.81 6.4516 0"
 PadDrills=" 0.2 0.25 0.3 0.35 0.4 0.45 0.5 0.55 0.65 0.7 0.75 0.8 0.85 0.9 1 0.6"
@@ -118,7 +118,7 @@ Type="Control Panel"
 Number=0
 
 [Desktop]
-Screen="1920 1080"
+Screen="3171 2520"
 Window="Win_1"
 Window="Win_2"
 Window="Win_3"
diff --git a/firmware/fab-step/src/main.cpp b/firmware/fab-step/src/main.cpp
index 70f62e0..1210023 100644
--- a/firmware/fab-step/src/main.cpp
+++ b/firmware/fab-step/src/main.cpp
@@ -135,6 +135,8 @@ void loop() {
   }
 }
 
+// -------------------------------------------------------- BUS INTERRUPT / STEP 
+
 uint8_t stepCache[2];
 volatile uint8_t cachePtr = 0;
 volatile boolean stepValid = false;
@@ -155,7 +157,11 @@ void ucBusDrop_onRxISR(void){
   // extract our step mask
   stepMask = 0b00000011 & (stepCache[cachePtr] >> (axisPick * 2));
   // mask -> step api:
-  (stepMask & 0b00000001) ? step_a4950_dir(true) : step_a4950_dir(false); // dir bit,
+  if(invert){
+    (stepMask & 0b00000001) ? step_a4950_dir(true) : step_a4950_dir(false); // dir bit,
+  } else {
+    (stepMask & 0b00000001) ? step_a4950_dir(false) : step_a4950_dir(true); // dir bit,
+  }
   if (stepMask & 0b00000010) step_a4950_step();                           // step bit
   // increment ptr -> next step mask, if over-wrap, steps no longer valid 
   cachePtr ++; if(cachePtr >= 2) stepValid = false;
diff --git a/log/fab-step-log.md b/log/fab-step-log.md
index 232345f..7ab9b5e 100644
--- a/log/fab-step-log.md
+++ b/log/fab-step-log.md
@@ -168,7 +168,7 @@ Assembling this now,
 | 10uF 1206 | 2 |
 | 10uF 0805 | 1 | 
 | LED 0805 | 2 |
-| 100mOhm 1206 | 2 |
+| 300mOhm 1206 | 2 |
 | 470R | 2 |
 | 10k | 2 |
 | 1M | 1 | 
@@ -178,6 +178,7 @@ Assembling this now,
 | RS485 | 2 | 
 | DRV | 1 | 
 | D21 | 1 | 
+| Vertical USB | 1 | 
 
 The two sizes of 10uf was a mistake, corrected that now. 
 
@@ -336,4 +337,8 @@ OK I've diffed all that... need to make a microstep update actually do something
 11752 / 24584 
 12520 / 24976
 
-Done, for the time being. Probably needs in-mcu guards against large rates. 
\ No newline at end of file
+Done, for the time being. Probably needs in-mcu guards against large rates. 
+
+## 2022 01 11 
+
+Back to assembling the -cl versions here. 
\ No newline at end of file
-- 
GitLab