Skip to content
Snippets Groups Projects
Commit 478ff3e8 authored by Jake Read's avatar Jake Read
Browse files

at successful ucbus ring test

parent eed7f8f7
Branches
No related tags found
No related merge requests found
...@@ -151,6 +151,7 @@ void setup() { ...@@ -151,6 +151,7 @@ void setup() {
ERRLIGHT_SETUP; ERRLIGHT_SETUP;
CLKLIGHT_SETUP; CLKLIGHT_SETUP;
DEBUG1PIN_SETUP; DEBUG1PIN_SETUP;
/*
// limit switch // limit switch
//limitSetup(); //limitSetup();
// osap // osap
...@@ -175,6 +176,10 @@ void setup() { ...@@ -175,6 +176,10 @@ void setup() {
osapAddVertex(homeStateEp); // 8 osapAddVertex(homeStateEp); // 8
// stepper init // stepper init
stepper_hw->init(false, c_scale); stepper_hw->init(false, c_scale);
*/
// bare serial
Serial.begin(9600);
ucBusDrop_setup(true, 0);
} }
// have available, // have available,
...@@ -185,9 +190,20 @@ void setup() { ...@@ -185,9 +190,20 @@ void setup() {
unsigned long lastTx = 0; unsigned long lastTx = 0;
uint8_t tstTx[14] = {1, 2, 3, 4, 5, 0, 7, 8, 9, 10, 11, 12, 13, 14}; uint8_t tstTx[14] = {1, 2, 3, 4, 5, 0, 7, 8, 9, 10, 11, 12, 13, 14};
uint8_t tstRx[256];
void loop() { void loop() {
osapLoop(); if(ucBusDrop_ctrB()){
stepper_hw->dacRefresh(); ERRLIGHT_TOGGLE;
uint16_t len = ucBusDrop_readB(tstRx);
logPacket(tstRx, len);
if(ucBusDrop_ctsB()){
CLKLIGHT_TOGGLE;
ucBusDrop_transmitB(tstRx, len);
}
}
//osapLoop();
//stepper_hw->dacRefresh();
#ifdef TEST_TX #ifdef TEST_TX
if(millis() > lastTx + 500){ if(millis() > lastTx + 500){
lastTx = millis(); lastTx = millis();
......
Subproject commit e926d28ae33499d1bbb96df5933fba47e7d5eec7 Subproject commit 7d0be7a5c309aab2a3300116c7e9fd2c425fc6cb
...@@ -24,37 +24,6 @@ boolean writeLenBytes(unsigned char* dest, uint16_t* dptr, uint16_t len){ ...@@ -24,37 +24,6 @@ boolean writeLenBytes(unsigned char* dest, uint16_t* dptr, uint16_t len){
} }
*/ */
#ifdef UCBUS_IS_DROP
//uint8_t escape[512];
//uint8_t escapeHeader[10] = { PK_BUSF_KEY, 0, 0, 0, 0, PK_PTR, PK_PORTF_KEY, 0, 0, PK_DEST };
// config-your-own-ll-escape-hatch
void sysError(String msg){
//ERRLIGHT_ON;
/*
uint32_t len = msg.length();
errBuf[0] = PK_LLERR; // the ll-errmsg-key
errBuf[1] = len & 255;
errBuf[2] = (len >> 8) & 255;
errBuf[3] = (len >> 16) & 255;
errBuf[4] = (len >> 24) & 255;
msg.getBytes(&(errBuf[5]), len + 1);
// write header,
memcpy(escape, escapeHeader, 10);
// write segsize, checksum
uint16_t wptr = 10;
ts_writeUint16(128, escape, &wptr);
ts_writeUint16(len + 5, escape, &wptr);
memcpy(&(escape[wptr]), errBuf, len + 5);
// transmit on ucbus
// potential here to hang-up and do while(!(ucBusDrop->cts())) ... I *think* that would clear on an interrupt
ucBusDrop->transmit(escape, len + wptr + 5);
*/
}
#else
// config-your-own-ll-escape-hatch // config-your-own-ll-escape-hatch
void sysError(String msg){ void sysError(String msg){
// whatever you want, // whatever you want,
...@@ -69,17 +38,11 @@ void sysError(String msg){ ...@@ -69,17 +38,11 @@ void sysError(String msg){
errBuf[6] = (len >> 24) & 255; errBuf[6] = (len >> 24) & 255;
msg.getBytes(&(errBuf[7]), len + 1); msg.getBytes(&(errBuf[7]), len + 1);
size_t ecl = cobsEncode(errBuf, len + 7, errEncoded); size_t ecl = cobsEncode(errBuf, len + 7, errEncoded);
// direct escape errEncoded[ecl] = 0; // add delimiter
//if(Serial.availableForWrite() > (int64_t)ecl){ // escape:
Serial.write(errEncoded, ecl); Serial.write(errEncoded, ecl + 1);
Serial.flush();
//} else {
// ERRLIGHT_ON;
//}
} }
#endif
void logPacket(uint8_t* pck, uint16_t len){ void logPacket(uint8_t* pck, uint16_t len){
String errmsg; String errmsg;
errmsg.reserve(1024); errmsg.reserve(1024);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment