Commit 84735ac0 authored by Jake Read's avatar Jake Read
Browse files

embedded deltas... from machine week activities? nothing major

parent 1e452de7
......@@ -1067,7 +1067,7 @@ design rules under a new name.</description>
<attribute name="NAME" x="27.686" y="41.402" size="1.016" layer="25"/>
<attribute name="VALUE" x="27.559" y="37.592" size="1.016" layer="27" ratio="10"/>
</element>
<element name="R8" library="passives" package="1206" value="1k" x="33.655" y="40.005" smashed="yes" rot="R180">
<element name="R8" library="passives" package="1206" value="470R" x="33.655" y="40.005" smashed="yes" rot="R180">
<attribute name="NAME" x="34.417" y="39.1795" size="1.016" layer="25" rot="R180"/>
<attribute name="PACKAGE" value="1206" x="33.655" y="40.005" size="1.016" layer="27" rot="R180" display="off"/>
<attribute name="PRECISION" value="" x="33.655" y="40.005" size="1.016" layer="27" rot="R180" display="off"/>
......@@ -1081,7 +1081,7 @@ design rules under a new name.</description>
<attribute name="NAME" x="27.686" y="38.862" size="1.016" layer="25"/>
<attribute name="VALUE" x="27.559" y="35.052" size="1.016" layer="27" ratio="10"/>
</element>
<element name="R9" library="passives" package="1206" value="1k" x="33.655" y="37.465" smashed="yes" rot="R180">
<element name="R9" library="passives" package="1206" value="470R" x="33.655" y="37.465" smashed="yes" rot="R180">
<attribute name="NAME" x="34.417" y="36.6395" size="1.016" layer="25" rot="R180"/>
<attribute name="PACKAGE" value="1206" x="33.655" y="37.465" size="1.016" layer="27" rot="R180" display="off"/>
<attribute name="PRECISION" value="" x="33.655" y="37.465" size="1.016" layer="27" rot="R180" display="off"/>
......@@ -1095,7 +1095,7 @@ design rules under a new name.</description>
<attribute name="NAME" x="27.686" y="36.322" size="1.016" layer="25"/>
<attribute name="VALUE" x="27.559" y="32.512" size="1.016" layer="27" ratio="10"/>
</element>
<element name="R10" library="passives" package="1206" value="1k" x="33.655" y="34.925" smashed="yes" rot="R180">
<element name="R10" library="passives" package="1206" value="470R" x="33.655" y="34.925" smashed="yes" rot="R180">
<attribute name="NAME" x="34.417" y="34.0995" size="1.016" layer="25" rot="R180"/>
<attribute name="PACKAGE" value="1206" x="33.655" y="34.925" size="1.016" layer="27" rot="R180" display="off"/>
<attribute name="PRECISION" value="" x="33.655" y="34.925" size="1.016" layer="27" rot="R180" display="off"/>
......@@ -1109,7 +1109,7 @@ design rules under a new name.</description>
<attribute name="NAME" x="27.686" y="33.782" size="1.016" layer="25"/>
<attribute name="VALUE" x="27.559" y="29.972" size="1.016" layer="27" ratio="10"/>
</element>
<element name="R11" library="passives" package="1206" value="1k" x="33.655" y="32.385" smashed="yes" rot="R180">
<element name="R11" library="passives" package="1206" value="470R" x="33.655" y="32.385" smashed="yes" rot="R180">
<attribute name="NAME" x="34.417" y="31.5595" size="1.016" layer="25" rot="R180"/>
<attribute name="PACKAGE" value="1206" x="33.655" y="32.385" size="1.016" layer="27" rot="R180" display="off"/>
<attribute name="PRECISION" value="" x="33.655" y="32.385" size="1.016" layer="27" rot="R180" display="off"/>
......@@ -1209,7 +1209,7 @@ design rules under a new name.</description>
<attribute name="NAME" x="27.305" y="31.115" size="1.27" layer="25"/>
<attribute name="VALUE" x="27.305" y="27.305" size="1.27" layer="27"/>
</element>
<element name="R7" library="passives" package="1206" value="1k" x="33.655" y="29.845" smashed="yes" rot="R180">
<element name="R7" library="passives" package="1206" value="470R" x="33.655" y="29.845" smashed="yes" rot="R180">
<attribute name="NAME" x="34.925" y="28.702" size="1.016" layer="25" rot="R180"/>
<attribute name="PACKAGE" value="1206" x="33.655" y="29.845" size="1.778" layer="27" font="vector" rot="R180" display="off"/>
<attribute name="PRECISION" value="" x="33.655" y="29.845" size="1.778" layer="27" font="vector" rot="R180" display="off"/>
......
......@@ -6325,22 +6325,22 @@ chip</description>
<part name="GND11" library="supply1" deviceset="GND" device=""/>
<part name="GND12" library="supply1" deviceset="GND" device=""/>
<part name="D2" library="lights" deviceset="LED" device="1206" value="LED1206"/>
<part name="R8" library="passives" deviceset="RESISTOR" device="1206" value="1k"/>
<part name="R8" library="passives" deviceset="RESISTOR" device="1206" value="470R"/>
<part name="+3V4" library="supply1" deviceset="+3V3" device=""/>
<part name="J15" library="SparkFun-Connectors" deviceset="CONN_02" device="LOCK"/>
<part name="GND17" library="supply1" deviceset="GND" device=""/>
<part name="D3" library="lights" deviceset="LED" device="1206" value="LED1206"/>
<part name="R9" library="passives" deviceset="RESISTOR" device="1206" value="1k"/>
<part name="R9" library="passives" deviceset="RESISTOR" device="1206" value="470R"/>
<part name="+3V5" library="supply1" deviceset="+3V3" device=""/>
<part name="J16" library="SparkFun-Connectors" deviceset="CONN_02" device="LOCK"/>
<part name="GND18" library="supply1" deviceset="GND" device=""/>
<part name="D4" library="lights" deviceset="LED" device="1206" value="LED1206"/>
<part name="R10" library="passives" deviceset="RESISTOR" device="1206" value="1k"/>
<part name="R10" library="passives" deviceset="RESISTOR" device="1206" value="470R"/>
<part name="+3V6" library="supply1" deviceset="+3V3" device=""/>
<part name="J17" library="SparkFun-Connectors" deviceset="CONN_02" device="LOCK"/>
<part name="GND19" library="supply1" deviceset="GND" device=""/>
<part name="D5" library="lights" deviceset="LED" device="1206" value="LED1206"/>
<part name="R11" library="passives" deviceset="RESISTOR" device="1206" value="1k"/>
<part name="R11" library="passives" deviceset="RESISTOR" device="1206" value="470R"/>
<part name="+3V7" library="supply1" deviceset="+3V3" device=""/>
<part name="J18" library="SparkFun-Connectors" deviceset="CONN_02" device="LOCK"/>
<part name="GND20" library="supply1" deviceset="GND" device=""/>
......@@ -6390,7 +6390,7 @@ chip</description>
<part name="P+5" library="supply1" deviceset="+5V" device=""/>
<part name="P+6" library="supply1" deviceset="+5V" device=""/>
<part name="D9" library="lights" deviceset="LED" device="1206" value="LED1206"/>
<part name="R7" library="passives" deviceset="RESISTOR" device="1206" value="1k"/>
<part name="R7" library="passives" deviceset="RESISTOR" device="1206" value="470R"/>
<part name="+3V3" library="supply1" deviceset="+3V3" device=""/>
<part name="J20" library="SparkFun-Connectors" deviceset="CONN_02" device="LOCK"/>
<part name="GND7" library="supply1" deviceset="GND" device=""/>
......
......@@ -19,7 +19,7 @@ UsedLibrary="C:/Dropbox/CBA/circuits/eagle/parts/SparkFun-Eagle-Libraries/SparkF
Type="Schematic Editor"
Number=1
File="2020-08_psu-breakout.sch"
View="-45.293 31.146 556.518 211.07"
View="191.998 139.609 359.952 189.822"
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"
......@@ -58,14 +58,14 @@ ArcDirection=0
AddLevel=2
PadsSameType=0
Layer=91
Views=" 1: -45.293 31.146 556.518 211.07"
Views=" 1: 191.998 139.609 359.952 189.822"
Sheet="1"
[Win_2]
Type="Board Editor"
Number=2
File="2020-08_psu-breakout.brd"
View="12.384 -7.24152 122.016 84.5385"
View="22.6761 -7.9544 114.036 68.529"
WireWidths=" 0.1016 0.15 0.2 2.54 0 0.508 0.2032 0.254 0.3048 0.4064 0.1524 1.016 1.27 0.127 0.6096 0.8128"
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.5 0.55 0.65 0.7 0.75 0.8 0.85 0.9 1 0.6 0.45"
......
......@@ -18,4 +18,21 @@ This is a circuit & mount for a small power supply and embedded system bus-head
### Firmware
I use this board mostly as the 'coordinator' for modular motion systems, firmware is [here](firmware) and uses platform.io to run, see [this guide](https://mtm.cba.mit.edu/2021/2021-10_microcontroller-primer/fab-platformio/) to build and load code.
\ No newline at end of file
I use this board mostly as the 'coordinator' for modular motion systems, firmware is [here](firmware) and uses platform.io to run, see [this guide](https://mtm.cba.mit.edu/2021/2021-10_microcontroller-primer/fab-platformio/) to build and load code.
### Shorthand BOM
- 7x 470R / 120R / LED Choice R
- 3x 1k
- 2x 4k7
- 2x 10k
- 4x 1uF
- 4x 10uF
- 8x LED,
- TVS Diode
- 2x Hi-Side Gate DRV MIC5014
- 3x NFET TPW4R008NH
- Optional I2C Display
- Optional 4x Pushbutton
- Optional Pololu D36V50F5 Regulator (PSU -> RPI)
- Optional RPI
\ No newline at end of file
// indicators for the module
// older module (with smt debug) these are *not routed* my mistake
// newer module they are PA27 and PB08 respectively
#define CLKLIGHT_PIN 27
#define CLKLIGHT_PORT PORT->Group[0]
#define CLKLIGHT_BM (uint32_t)(1 << CLKLIGHT_PIN)
#define CLKLIGHT_ON CLKLIGHT_PORT.OUTCLR.reg = CLKLIGHT_BM
#define CLKLIGHT_OFF CLKLIGHT_PORT.OUTSET.reg = CLKLIGHT_BM
#define CLKLIGHT_TOGGLE CLKLIGHT_PORT.OUTTGL.reg = CLKLIGHT_BM
#define CLKLIGHT_SETUP CLKLIGHT_PORT.DIRSET.reg = CLKLIGHT_BM; CLKLIGHT_OFF
#define ERRLIGHT_PIN 8
#define ERRLIGHT_PORT PORT->Group[1]
#define ERRLIGHT_BM (uint32_t)(1 << ERRLIGHT_PIN)
#define ERRLIGHT_ON ERRLIGHT_PORT.OUTCLR.reg = ERRLIGHT_BM
#define ERRLIGHT_OFF ERRLIGHT_PORT.OUTSET.reg = ERRLIGHT_BM
#define ERRLIGHT_TOGGLE ERRLIGHT_PORT.OUTTGL.reg = ERRLIGHT_BM
#define ERRLIGHT_SETUP ERRLIGHT_PORT.DIRSET.reg = ERRLIGHT_BM; ERRLIGHT_OFF
// PSU-breakout board lights,
#define DEBUG1PIN_PIN 13
#define DEBUG1PIN_PORT PORT->Group[0]
#define DEBUG1PIN_BM (uint32_t)(1 << DEBUG1PIN_PIN)
#define DEBUG1PIN_HI DEBUG1PIN_PORT.OUTSET.reg = DEBUG1PIN_BM
#define DEBUG1PIN_LO DEBUG1PIN_PORT.OUTCLR.reg = DEBUG1PIN_BM
// in the case of the psu-breakout-board, where this code probably lives, pin-hi is led-off, pin-lo is led-on,
#define DEBUG1PIN_ON DEBUG1PIN_LO
#define DEBUG1PIN_OFF DEBUG1PIN_HI
#define DEBUG1PIN_TOGGLE DEBUG1PIN_PORT.OUTTGL.reg = DEBUG1PIN_BM
#define DEBUG1PIN_SETUP DEBUG1PIN_PORT.DIRSET.reg = DEBUG1PIN_BM; DEBUG1PIN_HI
#define DEBUG2PIN_PIN 12
#define DEBUG2PIN_PORT PORT->Group[0]
#define DEBUG2PIN_BM (uint32_t)(1 << DEBUG2PIN_PIN)
#define DEBUG2PIN_HI DEBUG2PIN_PORT.OUTSET.reg = DEBUG2PIN_BM
#define DEBUG2PIN_LO DEBUG2PIN_PORT.OUTCLR.reg = DEBUG2PIN_BM
#define DEBUG2PIN_ON DEBUG2PIN_LO
#define DEBUG2PIN_OFF DEBUG2PIN_HI
#define DEBUG2PIN_TOGGLE DEBUG2PIN_PORT.OUTTGL.reg = DEBUG2PIN_BM
#define DEBUG2PIN_SETUP DEBUG2PIN_PORT.DIRSET.reg = DEBUG2PIN_BM; DEBUG2PIN_HI
#define DEBUG3PIN_PIN 15
#define DEBUG3PIN_PORT PORT->Group[1]
#define DEBUG3PIN_BM (uint32_t)(1 << DEBUG3PIN_PIN)
#define DEBUG3PIN_HI DEBUG3PIN_PORT.OUTSET.reg = DEBUG3PIN_BM
#define DEBUG3PIN_LO DEBUG3PIN_PORT.OUTCLR.reg = DEBUG3PIN_BM
#define DEBUG3PIN_ON DEBUG3PIN_LO
#define DEBUG3PIN_OFF DEBUG3PIN_HI
#define DEBUG3PIN_TOGGLE DEBUG3PIN_PORT.OUTTGL.reg = DEBUG3PIN_BM
#define DEBUG3PIN_SETUP DEBUG3PIN_PORT.DIRSET.reg = DEBUG3PIN_BM; DEBUG3PIN_HI
#define DEBUG4PIN_PIN 14
#define DEBUG4PIN_PORT PORT->Group[1]
#define DEBUG4PIN_BM (uint32_t)(1 << DEBUG4PIN_PIN)
#define DEBUG4PIN_HI DEBUG4PIN_PORT.OUTSET.reg = DEBUG4PIN_BM
#define DEBUG4PIN_LO DEBUG4PIN_PORT.OUTCLR.reg = DEBUG4PIN_BM
#define DEBUG4PIN_ON DEBUG4PIN_LO
#define DEBUG4PIN_OFF DEBUG4PIN_HI
#define DEBUG4PIN_TOGGLE DEBUG4PIN_PORT.OUTTGL.reg = DEBUG4PIN_BM
#define DEBUG4PIN_SETUP DEBUG4PIN_PORT.DIRSET.reg = DEBUG4PIN_BM; DEBUG4PIN_HI
\ No newline at end of file
// circuit specific indicators: modular-motion-head 2021-08-26
#define PIN_BM(pin) (uint32_t)(1 << pin)
#define PIN_HI(port, pin) PORT->Group[port].OUTSET.reg = PIN_BM(pin)
#define PIN_LO(port, pin) PORT->Group[port].OUTCLR.reg = PIN_BM(pin)
#define PIN_TGL(port, pin) PORT->Group[port].OUTTGL.reg = PIN_BM(pin)
#define PIN_SETUP_OUTPUT(port, pin) PORT->Group[port].DIRSET.reg = PIN_BM(pin)
#define CLKLIGHT_ON PIN_LO(0, 27)
#define CLKLIGHT_OFF PIN_HI(0, 27)
#define CLKLIGHT_TOGGLE PIN_TGL(0, 27)
#define CLKLIGHT_SETUP PIN_SETUP_OUTPUT(0, 27); CLKLIGHT_OFF
#define ERRLIGHT_ON PIN_LO(1, 8)
#define ERRLIGHT_OFF PIN_HI(1, 8)
#define ERRLIGHT_TOGGLE PIN_TGL(1, 8)
#define ERRLIGHT_SETUP PIN_SETUP_OUTPUT(1, 8); ERRLIGHT_OFF
// breakout debugs are pin-to-gnd,
// PA13, PA12, PB15, PB14, PA04
#define DEBUG1PIN_ON PIN_LO(0, 13)
#define DEBUG1PIN_OFF PIN_HI(0, 13)
#define DEBUG1PIN_HI PIN_HI(0, 13)
#define DEBUG1PIN_LO PIN_LO(0, 13)
#define DEBUG1PIN_TOGGLE PIN_TGL(0, 13)
#define DEBUG1PIN_SETUP PIN_SETUP_OUTPUT(0, 13); PIN_HI(0, 13)
#define DEBUG2PIN_ON PIN_LO(0, 13)
#define DEBUG2PIN_OFF PIN_HI(0, 13)
#define DEBUG2PIN_HI PIN_HI(0, 13)
#define DEBUG2PIN_LO PIN_LO(0, 13)
#define DEBUG2PIN_TOGGLE PIN_TGL(0, 13)
#define DEBUG2PIN_SETUP PIN_SETUP_OUTPUT(0, 13); PIN_HI(0, 13)
#define DEBUG3PIN_ON PIN_LO(1, 15)
#define DEBUG3PIN_OFF PIN_HI(1, 15)
#define DEBUG3PIN_HI PIN_HI(1, 15)
#define DEBUG3PIN_LO PIN_LO(1, 15)
#define DEBUG3PIN_TOGGLE PIN_TGL(1, 15)
#define DEBUG3PIN_SETUP PIN_SETUP_OUTPUT(1, 15); PIN_HI(1, 15)
#define DEBUG4PIN_ON PIN_LO(1, 14)
#define DEBUG4PIN_OFF PIN_HI(1, 14)
#define DEBUG4PIN_HI PIN_HI(1, 14)
#define DEBUG4PIN_LO PIN_LO(1, 14)
#define DEBUG4PIN_TOGGLE PIN_TGL(1, 14)
#define DEBUG4PIN_SETUP PIN_SETUP_OUTPUT(1, 14); PIN_HI(1, 14)
#define DEBUG5PIN_ON PIN_LO(0, 4)
#define DEBUG5PIN_OFF PIN_HI(0, 4)
#define DEBUG5PIN_HI PIN_HI(0, 4)
#define DEBUG5PIN_LO PIN_LO(0, 4)
#define DEBUG5PIN_TOGGLE PIN_TGL(0, 4)
#define DEBUG5PIN_SETUP PIN_SETUP_OUTPUT(0, 4); PIN_HI(0, 4)
......@@ -51,7 +51,7 @@ EP_ONDATA_RESPONSES onMoveData(uint8_t* data, uint16_t len){
// do load
float target[3] = {targetChunks[0].f, targetChunks[1].f, targetChunks[2].f };
//sysError("targets, rate: " + String(target[0], 6) + ", " + String(target[1], 6) + ", " + String(target[2], 6) + ", " + String(feedrateChunk.f, 6));
planner->append_move(target, SR_NUM_MOTORS, feedrateChunk.f, targetChunks[3].f); // mm/min -> mm/sec
planner->append_move(target, SR_NUM_MOTORS, feedrateChunk.f, targetChunks[3].f); // it's mm/sec
return EP_ONDATA_ACCEPT;
}
} else {
......@@ -60,15 +60,10 @@ EP_ONDATA_RESPONSES onMoveData(uint8_t* data, uint16_t len){
}
}
vertex_t* moveQueueEp = osapBuildEndpoint("moveQueue", onMoveData, nullptr); // 2
endpoint_t* moveQueueEp = osapBuildEndpoint("moveQueue", onMoveData); // 2
// -------------------------------------------------------- POSITION ENDPOINT
EP_ONDATA_RESPONSES onPositionSet(uint8_t* data, uint16_t len);
boolean beforePositionQuery(void);
vertex_t* positionEp = osapBuildEndpoint("position", onPositionSet, beforePositionQuery); // 3
EP_ONDATA_RESPONSES onPositionSet(uint8_t* data, uint16_t len){
// only if it's not moving,
if(smoothie_is_moving()){
......@@ -88,55 +83,47 @@ EP_ONDATA_RESPONSES onPositionSet(uint8_t* data, uint16_t len){
}
}
boolean beforePositionQuery(void){
endpoint_t* positionEp = osapBuildEndpoint("positions", onPositionSet); // 3
uint8_t posData[16];
void updatePositions(void){
// write new pos data periodically,
uint8_t posData[16];
uint16_t poswptr = 0;
ts_writeFloat32(smoothieRoll->actuators[0]->floating_position, posData, &poswptr);
ts_writeFloat32(smoothieRoll->actuators[1]->floating_position, posData, &poswptr);
ts_writeFloat32(smoothieRoll->actuators[2]->floating_position, posData, &poswptr);
ts_writeFloat32(smoothieRoll->actuators[3]->floating_position, posData, &poswptr);
memcpy(positionEp->ep->data, posData, 16);
positionEp->ep->dataLen = 16;
return true;
endpointWrite(positionEp, posData, 16);
}
// -------------------------------------------------------- CURRENT SPEEDS
boolean beforeSpeedQuery(void);
vertex_t* speedEp = osapBuildEndpoint("speed", nullptr, beforeSpeedQuery);
endpoint_t* speedEp = osapBuildEndpoint("speeds");
uint8_t speedData[16];
boolean beforeSpeedQuery(void){
void updateSpeeds(void){
// collect actuator speeds,
uint8_t speedData[16];
uint16_t wptr = 0;
ts_writeFloat32(smoothieRoll->actuators[0]->get_current_speed(), speedData, &wptr);
ts_writeFloat32(smoothieRoll->actuators[1]->get_current_speed(), speedData, &wptr);
ts_writeFloat32(smoothieRoll->actuators[2]->get_current_speed(), speedData, &wptr);
ts_writeFloat32(smoothieRoll->actuators[3]->get_current_speed(), speedData, &wptr);
memcpy(speedEp->ep->data, speedData, 16);
speedEp->ep->dataLen = 16;
return true;
endpointWrite(speedEp, speedData, 16);
}
// -------------------------------------------------------- MOTION STATE EP
boolean beforeMotionStateQuery(void);
endpoint_t* motionStateEp = osapBuildEndpoint("motionState"); // 4
uint8_t motionData[1];
vertex_t* motionStateEp = osapBuildEndpoint("motionState", nullptr, beforeMotionStateQuery); // 4
boolean beforeMotionStateQuery(void){
uint8_t motion;
void updateMotionState(void){
if(smoothieRoll->actuators[0]->is_moving() || smoothieRoll->actuators[1]->is_moving() || smoothieRoll->actuators[2]->is_moving() || !smoothie_is_queue_empty()){
motion = 1;
motionData[0] = 1;
} else {
motion = 0;
motionData[0] = 0;
}
motionStateEp->ep->data[0] = motion;
motionStateEp->ep->dataLen = 1;
//sysError("motion query " + String(motion));
return true;
endpointWrite(motionStateEp, motionData, 1);
}
// -------------------------------------------------------- WAIT TIME EP
......@@ -152,7 +139,7 @@ EP_ONDATA_RESPONSES onWaitTimeData(uint8_t* data, uint16_t len){
return EP_ONDATA_ACCEPT;
}
vertex_t* waitTimeEp = osapBuildEndpoint("waitTime", onWaitTimeData, nullptr); // 5
endpoint_t* waitTimeEp = osapBuildEndpoint("waitTime", onWaitTimeData); // 5
// -------------------------------------------------------- ACCEL SETTTINGS
......@@ -172,7 +159,7 @@ EP_ONDATA_RESPONSES onAccelSettingsData(uint8_t* data, uint16_t len){
return EP_ONDATA_ACCEPT;
}
vertex_t* accelSettingsEp = osapBuildEndpoint("accelSettings", onAccelSettingsData, nullptr);
endpoint_t* accelSettingsEp = osapBuildEndpoint("accelSettings", onAccelSettingsData);
// -------------------------------------------------------- RATES SETTINGS
......@@ -192,7 +179,7 @@ EP_ONDATA_RESPONSES onRateSettingsData(uint8_t* data, uint16_t len){
return EP_ONDATA_ACCEPT;
}
vertex_t* rateSettingsEp = osapBuildEndpoint("rateSettings", onRateSettingsData, nullptr);
endpoint_t* rateSettingsEp = osapBuildEndpoint("rateSettings", onRateSettingsData);
// -------------------------------------------------------- SETUP
......@@ -203,29 +190,30 @@ void setup() {
DEBUG2PIN_SETUP;
DEBUG3PIN_SETUP;
DEBUG4PIN_SETUP;
DEBUG5PIN_SETUP;
// osap
osapSetup();
osapSetup("modularMotionHead");
// ports
vt_usbSerial_setup();
osapAddVertex(vt_usbSerial); // 0
vt_ucBusHead_setup();
osapAddVertex(vt_ucBusHead); // 1
// move to queue
osapAddVertex(moveQueueEp); // 2
osapAddEndpoint(moveQueueEp); // 2
// position
osapAddVertex(positionEp); // 3
osapAddEndpoint(positionEp); // 3
// speed
osapAddVertex(speedEp); // 4
osapAddEndpoint(speedEp); // 4
// motion state
osapAddVertex(motionStateEp); // 5
osapAddEndpoint(motionStateEp); // 5
// set wait time (ms)
osapAddVertex(waitTimeEp); // 6
osapAddEndpoint(waitTimeEp); // 6
// acceler8 settings
osapAddVertex(accelSettingsEp); // 7
osapAddEndpoint(accelSettingsEp); // 7
// r8 settings
osapAddVertex(rateSettingsEp); // 8
osapAddEndpoint(rateSettingsEp); // 8
// smoothie (and frequency of loop below)
smoothieRoll->init(20000);
smoothieRoll->init(10000);
// 25kHz base (40us period) or
// 20kHz base (50us period)
// 10kHz base (100us period)
......@@ -233,11 +221,23 @@ void setup() {
d51ClockBoss->start_ticker_a(100);
}
unsigned long epUpdateInterval = 100; // ms
unsigned long lastUpdate = 0;
void loop() {
// write ~ every second, transmit on chb to drop 1
// check indices on the way down / up ... was shifting, are not anymore
// main recursive osap loop:
osapLoop();
conveyor->on_idle(nullptr);
// smoothie checks / etc:
//conveyor->on_idle(nullptr);
// run 10Hz endpoint update:
if(millis() > lastUpdate + epUpdateInterval){
DEBUG5PIN_TOGGLE;
lastUpdate = millis();
updatePositions();
updateSpeeds();
updateMotionState();
}
} // end loop
// runs on period defined by timer_a setup:
......@@ -262,7 +262,7 @@ void TC0_Handler(void){
// each of these ticks drops 10 data bytes, so if we have 17 byte packet, can do every 2nd packet
// which would occupy the full bus - notgood - or we can do every 3rd... I'll pick every 4th.
timeTick ++;
if(timeTick > 3){
if(timeTick > 2){
DEBUG2PIN_HI;
timeTick = 0;
uint16_t mpptr = 0; // motion packet pointer
......@@ -290,4 +290,4 @@ void TC0_Handler(void){
timeBlink = 0;
}
DEBUG1PIN_LO;
}
}
\ No newline at end of file
Subproject commit 23064339e200c3819af8bc55988b57d3eaa28a2e
Subproject commit acbff5f3f0333d072780d32246ac15a6aa7f1a62
......@@ -62,7 +62,6 @@ void StepTicker::start(){
#warning This leaves config as is, see startup to 'make proper'.
void StepTicker::set_frequency( float frequency ){
this->frequency = frequency;
this->period = 80; // set manually above, floorf((SystemCoreClock / 4.0F) / frequency); // SystemCoreClock/4 = Timer increments in a second
}
// step clock
......
......@@ -40,7 +40,6 @@ class StepTicker{
bool start_next_block();
float frequency;
uint32_t period;
// not using motor refs, direct stepping std::array<StepperMotor*, k_max_actuators> motor;
// do adhoc hack
StepInterface* motor[SR_NUM_MOTORS];
......
......@@ -229,7 +229,8 @@ bool Planner::append_block( ActuatorCoordinates &actuator_pos, uint8_t n_motors,
block->nominal_speed = rate_mm_s; // (mm/s) Always > 0
block->nominal_rate = block->steps_event_count * rate_mm_s / distance; // (step/s) Always > 0
} else {
sysError("now distance, nominal rate and speed to zero...");
sysError("bad move call! rejecting");
return false;
block->nominal_speed = 0.0F;
block->nominal_rate = 0;
}
......
......@@ -47,7 +47,7 @@ class StepInterface {
float max_rate = 10.0F; // in mm/sec ?
float accel = 100.0F; // in mm/sec/sec
float steps_per_mm = 400.0F; // for everyone: this is a hack... actually we send floating posns to steppers, who deal with this config
float steps_per_mm = 25.0F; // for everyone: this is a hack... actually we send floating posns to steppers, who deal with this config
float mm_per_step = 1 / steps_per_mm;
int32_t last_milestone_steps = 0;
float last_milestone_mm = 0;
......
......@@ -97,6 +97,20 @@ Then the scheme here is to pin the face of the PSU (backside, I guess: where the
Alright, this is fine. Not the most beautiful of devices. Onwards.
## 2022 01 09
Finally - sheesh - bringing this up, so that I can remotely switch 24V and 5V, better resetting system state. This is kind of ... not a necessary piece of kit, but is "nice". Arguably the system should go either to a fab-able SAMD21 board, for accessibility, or to a Teensy, for performance. I suppose the teensy version could be accessible as well...
In any case, code... then a test of the switching stuff... then the fab-step work, and maybe we make the step-tick stuff a little better, i.e. actually issuing steps (?) rather than this floating point work, which is awkwards anyways. Maybe this'll be a little bit fun, and maybe it'll get us to the fab-abble motion system that we want as a stopgap! Or maybe all failure, too soon to tell.
Arg it seems like something I've done w/ the new endpoint API is bricking this.
God bless, just a recursive overloaded function that was calling itself, when I meant to call a different version of the same name. Whoop!
OK I can try a 5v turn-on-off code. I guess I'll build my little one-motor-single-page-demo controller as well, sheesh.
- 5v src / sinks ?
## Part Purchase
- pololu https://www.pololu.com/product/4091 5vreg 7a
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment