Commit cc5ec1b8 authored by Wouter Klop's avatar Wouter Klop

Still working on parameter lib

parent 680570b1
......@@ -49,7 +49,7 @@ parList::parList(par* _l) {
par::cmdCounter = 0;
}
void parList::sendList(WebSocketsServer wsServer) {
void parList::sendList(WebSocketsServer *wsServer) {
uint8_t buf[6];
cmd c;
......@@ -59,7 +59,7 @@ void parList::sendList(WebSocketsServer wsServer) {
Serial << groupNo << "\t" << l[i].cmd << "\t" << l[i].getFloat() << endl;
c.cmd2 = l[i].cmd;
c.val = l[i].getFloat();
wsServer.sendBIN(0,c.arr,6);
wsServer->sendBIN(0,c.arr,6);
}
}
......
......@@ -77,7 +77,7 @@ private:
class parList {
public:
parList(par* _l);
void sendList(WebSocketsServer wsServer);
void sendList(WebSocketsServer *wsServer);
void parseMessage(uint8_t* c);
static uint8_t groupCounter;
......
......@@ -135,7 +135,8 @@ float speedFilterConstant = 0.9;
const char host[] = "balancingrobot";
// ----- Parameter definitions -----
par pidPar[] = {{&pid[0].K}, {&pid[0].Ti}, {&pid[0].Td}, {&pid[0].N}};
par pidPar[] = {{&pid[0].K}, {&pid[0].Ti}, {&pid[0].Td}, {&pid[0].N}, {&pid[0].R}, {&pid[0].minOutput}, {&pid[0].minOutput}};
// Use default arguments for PID constructor
parList pidParList(pidPar);
// ----- Interrupt functions -----
......@@ -156,10 +157,14 @@ void setMotorCurrent() {
dacWrite(motorCurrentPin, motorCurrent);
}
void sendData(uint8_t *b, uint8_t l) {
wsServer.sendBIN(0,b,l);
}
void wirelessTask(void * parameters) {
while (1) {
IBus.loop();
wsServer.loop(); // Shouldn't this run on core 0?
wsServer.loop();
delay(1);
}
}
......@@ -629,7 +634,7 @@ void parseCommand(char* data, uint8_t length) {
case 'r':
// Serial.println("Rebooting...");
// ESP.restart();
pidParList.sendList(wsServer);
pidParList.sendList(&wsServer);
break;
case 'l': // Send wifi networks to WS client
sendWifiList();
......
Markdown is supported
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