Commit 478ff3e8 authored by Jake Read's avatar Jake Read
Browse files

at successful ucbus ring test

parent eed7f8f7
......@@ -151,6 +151,7 @@ void setup() {
ERRLIGHT_SETUP;
CLKLIGHT_SETUP;
DEBUG1PIN_SETUP;
/*
// limit switch
//limitSetup();
// osap
......@@ -175,6 +176,10 @@ void setup() {
osapAddVertex(homeStateEp); // 8
// stepper init
stepper_hw->init(false, c_scale);
*/
// bare serial
Serial.begin(9600);
ucBusDrop_setup(true, 0);
}
// have available,
......@@ -185,9 +190,20 @@ void setup() {
unsigned long lastTx = 0;
uint8_t tstTx[14] = {1, 2, 3, 4, 5, 0, 7, 8, 9, 10, 11, 12, 13, 14};
uint8_t tstRx[256];
void loop() {
osapLoop();
stepper_hw->dacRefresh();
if(ucBusDrop_ctrB()){
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
if(millis() > lastTx + 500){
lastTx = millis();
......
Subproject commit e926d28ae33499d1bbb96df5933fba47e7d5eec7
Subproject commit 7d0be7a5c309aab2a3300116c7e9fd2c425fc6cb
......@@ -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
void sysError(String msg){
// whatever you want,
......@@ -69,17 +38,11 @@ void sysError(String msg){
errBuf[6] = (len >> 24) & 255;
msg.getBytes(&(errBuf[7]), len + 1);
size_t ecl = cobsEncode(errBuf, len + 7, errEncoded);
// direct escape
//if(Serial.availableForWrite() > (int64_t)ecl){
Serial.write(errEncoded, ecl);
Serial.flush();
//} else {
// ERRLIGHT_ON;
//}
errEncoded[ecl] = 0; // add delimiter
// escape:
Serial.write(errEncoded, ecl + 1);
}
#endif
void logPacket(uint8_t* pck, uint16_t len){
String errmsg;
errmsg.reserve(1024);
......
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