Fix build errors

master
Emil Miler 5 years ago
parent a8afbea8cb
commit 5dc69c95f3

@ -17,11 +17,11 @@ void setup()
void loop() void loop()
{ {
uint8_t buf[2]; uint8_t buf[2];
size_t buf_len = sizeof(buf); // rip size_t buf_len = sizeof(buf);
if (driver.recv(buf, &buf_len)){ if (driver.recv(buf, buf_len)){
uint8_t value = buf[1]; uint8_t value = buf[0];
uint8_t ch = [buf]2; uint8_t ch = buf[1];
// 0 -> 3; 1 -> 5; 2 -> 6 // 0 -> 3; 1 -> 5; 2 -> 6
ch = (ch ? ++ch + 3 : 3); ch = (ch ? ++ch + 3 : 3);

@ -15,12 +15,11 @@ void setup()
void loop() void loop()
{ {
for(uint8_t i = 0; i < 3; i++) { for(uint8_t i = 0; i < 3; i++) {
uint8_t val = (uint8_t)analogRead(i)/4; int val = analogRead(i)/4;
if(val >= lastval[i]+3 || val <= lastval[i]-3){ if(val >= lastval[i]+3 || val <= lastval[i]-3){
uint8_t msg[2] = { val, i }; uint8_t msg[2] = { val, i };
Serial.println(msg);
driver.send((uint8_t *)msg, 2); driver.send((uint8_t *)msg, 2);
driver.waitPacketSent(); driver.waitPacketSent();