Coding Error in Sonar function

This forum is dedicated to software development related to MultiWii.
It is not the right place to submit a setup problem.
Software download
Post Reply
weebly
Posts: 13
Joined: Thu Feb 20, 2014 3:33 pm

Coding Error in Sonar function

Post by weebly »

I'm trying to use sonar function for my obstacle avoiding project. But I cant fix this compile error . Please help me ,,

ERROR:
Sensors.cpp: In function 'uint16_t i2c_readReg16(int8_t, int8_t)':
Sensors.cpp:1673: error: cannot convert 'uint8_t (*)[2]' to 'uint8_t*' for argument '3' to 'void i2c_read_reg_to_buf(uint8_t, uint8_t, uint8_t*, uint8_t)'


RELATED FUNCTIONS:
uint16_t i2c_readReg16(int8_t addr, int8_t reg) {
uint8_t b[2];
i2c_read_reg_to_buf(addr, reg, &b, sizeof(b));
return (b[0]<<8) | b[1];
}



void i2c_read_reg_to_buf(uint8_t add, uint8_t reg, uint8_t *buf, uint8_t size) {
i2c_rep_start(add<<1); // I2C write direction
i2c_write(reg); // register selection
i2c_rep_start((add<<1) | 1); // I2C read direction
uint8_t *b = buf;
while (size--) {
/* acknowledge all but the final byte */
*b++ = i2c_read(size > 0);
}
}

Pat1300
Posts: 12
Joined: Fri Aug 03, 2012 11:31 am
Location: Wavre - BELGIUM

Re: Coding Error in Sonar function

Post by Pat1300 »

Try to modify to:

i2c_read_reg_to_buf(addr, reg, b, sizeof(b));

or

i2c_read_reg_to_buf(addr, reg, &b[0], sizeof(b));

( Those two C lines are strictly the same ! )

Patrick

zubair
Posts: 1
Joined: Mon Apr 27, 2015 6:54 pm

error while connecting to multiwii gui 2.3

Post by zubair »

hello everyone...
iam new here and i am working on ublox gps with multiwii 2.3 and while connecting to multiwii gui 2.3 its showing error that "unhandelled expression...value 255 should be between minimum and maximum value."
please help me out in this guys..
or mail me the solution on my id :- kzbr1993@gmail.com

thankyou
Attachments
Untitled.png

Post Reply