Timeline for Passing reference to hardware between methods in custom class
Current License: CC BY-SA 4.0
33 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Sep 24, 2020 at 16:06 | history | bumped | Community Bot | This question has answers that may be good or bad; the system has marked it active so that they can be reviewed. | |
May 27, 2020 at 16:06 | history | bumped | Community Bot | This question has answers that may be good or bad; the system has marked it active so that they can be reviewed. | |
Jan 28, 2020 at 15:03 | history | bumped | Community Bot | This question has answers that may be good or bad; the system has marked it active so that they can be reviewed. | |
Sep 30, 2019 at 15:01 | history | bumped | Community Bot | This question has answers that may be good or bad; the system has marked it active so that they can be reviewed. | |
Jun 2, 2019 at 14:02 | history | bumped | Community Bot | This question has answers that may be good or bad; the system has marked it active so that they can be reviewed. | |
May 3, 2019 at 9:01 | history | bumped | Community Bot | This question has answers that may be good or bad; the system has marked it active so that they can be reviewed. | |
Jan 3, 2019 at 8:03 | history | bumped | Community Bot | This question has answers that may be good or bad; the system has marked it active so that they can be reviewed. | |
Dec 4, 2018 at 7:02 | history | bumped | Community Bot | This question has answers that may be good or bad; the system has marked it active so that they can be reviewed. | |
Nov 4, 2018 at 7:00 | history | bumped | Community Bot | This question has answers that may be good or bad; the system has marked it active so that they can be reviewed. | |
Oct 5, 2018 at 7:00 | history | bumped | Community Bot | This question has answers that may be good or bad; the system has marked it active so that they can be reviewed. | |
Sep 5, 2018 at 6:01 | history | bumped | Community Bot | This question has answers that may be good or bad; the system has marked it active so that they can be reviewed. | |
Aug 6, 2018 at 5:22 | history | edited | dda | CC BY-SA 4.0 |
deleted 308 characters in body; edited title
|
Aug 5, 2018 at 22:02 | history | bumped | Community Bot | This question has answers that may be good or bad; the system has marked it active so that they can be reviewed. | |
Jul 6, 2018 at 21:17 | history | bumped | Community Bot | This question has answers that may be good or bad; the system has marked it active so that they can be reviewed. | |
Jun 6, 2018 at 20:46 | history | bumped | Community Bot | This question has answers that may be good or bad; the system has marked it active so that they can be reviewed. | |
May 8, 2018 at 8:38 | comment | added | Mikael Patel |
Change static void SetupSensors(MPU9250_DMP *imu); to static void SetupSensors(MPU9250_DMP& imu); in both source and header file. Do the same change to ReadSensors . BW why are you using static for SetupSensors .
|
|
May 7, 2018 at 10:46 | history | edited | Hamish_Fernsby | CC BY-SA 4.0 |
added missing code after if (imu.begin() != INV_SUCCESS)
|
May 7, 2018 at 10:33 | comment | added | Nick Gammon♦ | And if you have changed the code, please post the amended code. We can't debug code we can't see. | |
May 7, 2018 at 10:27 | comment | added | Nick Gammon♦ | No, not at all. | |
May 7, 2018 at 10:23 | comment | added | Hamish_Fernsby | @Nick re why classes - reason for moving this bit of code into a seperate .cpp unit is that the program is about to get a lot more complex, plenty of maths and GPRS comms, so the sensor setup/read seemed like a logical chunk to move out of the main.ino I am presuming that the seperate .cpp unit necesitates defining a class? | |
May 7, 2018 at 10:16 | comment | added | Hamish_Fernsby | @Mikael, new to pointers, I tried MPU9250_DMP* imu and MPU9250_DMP *imu Either way I get this error - no known conversion for argument 1 from 'MPU9250_DMP' to 'MPU9250_DMP& imu gives the same sub-sensor returning zeros problem. | |
May 7, 2018 at 8:32 | answer | added | Nick Gammon ♦ | timeline score: 1 | |
May 7, 2018 at 8:20 | history | edited | Hamish_Fernsby | CC BY-SA 4.0 |
added cdsensors.h
|
May 7, 2018 at 7:46 | comment | added | Nick Gammon♦ | Why are you using classes at all? Are there going to be lots of sensors? If so, making a member function static doesn't make any sense. | |
May 7, 2018 at 7:44 | comment | added | Nick Gammon♦ |
Can you post CDSensors.h? I can't make any sense of CDSensors* LSensors = &CDSensors (0); CDSerialPrint* LSerialPrint = &CDSerialPrint (0); As the warning says, you are taking the address of a temporary, something that ceases to exist at the end of that line.
|
|
May 7, 2018 at 7:18 | comment | added | chrisl | How die you define it in the class? Did you execute its constructor? If not, that might have been the problem | |
May 7, 2018 at 7:13 | comment | added | Hamish_Fernsby | @Nisse sorry tidied indents & typo, resolved your comment I think. | |
May 7, 2018 at 7:08 | comment | added | Hamish_Fernsby | @ChrisL When it was defined just in CDSensors class ithe sensor returned all zeros. I checked with local serialprint, I suppose somehow the connection between settings and reading data is lost. | |
May 7, 2018 at 7:07 | history | edited | Hamish_Fernsby | CC BY-SA 4.0 |
typo, tidied indents
|
May 6, 2018 at 11:31 | comment | added | Mikael Patel |
Try passing the imu parameter by-reference (instead of by-copy), i.e. MPU9250_DMP& imu , to the SetupSensors and ReadSensors member functions.
|
|
May 5, 2018 at 18:29 | comment | added | chrisl |
Is there a reason, why you are defining the MPU9250_DMP outside of your class and in your main sketch? If you declare it inside of the class as a member variable you can ditch the reference handling
|
|
May 5, 2018 at 17:49 | history | edited | Hamish_Fernsby | CC BY-SA 4.0 |
typo
|
May 5, 2018 at 17:37 | history | asked | Hamish_Fernsby | CC BY-SA 4.0 |