UBC-Snowbots / RoverFlake

New repository for UBC Rover
5 stars 1 forks source link

Use Zephyr RTOS to create serial driver for Magnemometer sensor #34

Open Roozki opened 1 year ago

stephenqiao1 commented 1 year ago

Was able to detect the imu sensor with the esp32 and zephyr rtos, but still trying to figure out why it isn't able to read and process the magnetometer data

Roozki commented 1 year ago

nice work so far, your code looks good to me. what is it outputting? also how well is the serial connection? your code looks much cleaner than my implementation lol

stephenqiao1 commented 1 year ago

Im not sure what you mean by how good the serial connection is but the output is like this right now: Screenshot from 2023-11-18 20-29-29

Roozki commented 1 year ago

yeah, i want to make some packages that test serial speed and whatnot but if you haven't noticed any problems with the serial connection (connects every time, no garbage values, sends at the rates you want it to, etc) then it should be ok. That output might be something messing up with changing data types, or the IMU is just faulty.

at line 41 in your main: printk("Magnetometer X: %d.%06d, Y: %d.%06d, Z: %d.%06d\n", is a little odd as you are printing floats with the %d. does %f work? like:

printk("Magnetometer X: %0.6f, Y: %0.6f, Z: %0.6f\n", or was this on purpose to print the integer as a float?

stephenqiao1 commented 12 months ago

i used the samples they had on the zephyr site. Im trying to debug by printing log messages from the driver source files, but for some reason I cant print the LOG_DBG() messages