Author |
Message |
Synergists
Rookie
Joined: Mon Dec 15, 2014 12:46 am Posts: 19
|
 Way to Tell if SMUX is Not Responding? Battery Level?
Hello again, Is there a way to tell whether or not the SMUX is connected? I have looked through the SMUX driver, but it is a little more complicated to me than the joystick driver....
Also, is there a way to read the battery level?
_________________ FTC 7104 - The Synergists
|
Sun Jan 11, 2015 8:12 pm |
|
 |
MHTS
Guru
Joined: Sun Nov 15, 2009 5:46 am Posts: 1523
|
 Re: Way to Tell if SMUX is Not Responding? Battery Level?
I am not familiar with the inner working of the sensor mux. Xander is probably a better person to answer this but in theory you probably could try sending an I2C command to the MUX and see if returns an error. I don't know what is a valid MUX command you can see though. Regarding the battery level of the MUX, unfortunately I don't think that's possible. I would love to be able to do it too since you can't tell if that battery is running low and needs replacement. So we tend to replace to a fresh battery on competition day.
|
Mon Jan 12, 2015 3:05 am |
|
 |
Synergists
Rookie
Joined: Mon Dec 15, 2014 12:46 am Posts: 19
|
 Re: Way to Tell if SMUX is Not Responding? Battery Level?
Ok. I might play around with it, but it is not a high priority.... That's too bad...no battery info! 
_________________ FTC 7104 - The Synergists
|
Tue Jan 13, 2015 12:54 am |
|
 |
akash329dsouza
Novice
Joined: Tue Dec 16, 2014 10:25 am Posts: 81
|
 Re: Way to Tell if SMUX is Not Responding? Battery Level?
Let me know because this would be useful to have at competitions where it could beep or something if you forgot to turn on the mux
_________________ Thanks!
|
Wed Jan 14, 2015 1:07 am |
|
 |
akash329dsouza
Novice
Joined: Tue Dec 16, 2014 10:25 am Posts: 81
|
 Re: Way to Tell if SMUX is Not Responding? Battery Level?
Ok so I was looking around and xanders driver has functions for low battery check and levels of battery. Do you guys know how to use them in a program? http://botbench.com/driversuite/group__htsmux.html#gadf42695ce182bb940e3cf966c82d4403
_________________ Thanks!
|
Wed Jan 14, 2015 1:13 am |
|
 |
MHTS
Guru
Joined: Sun Nov 15, 2009 5:46 am Posts: 1523
|
 Re: Way to Tell if SMUX is Not Responding? Battery Level?
All this info is actually extracted from Xander's source code. What made you think there is functionality to check for low battery? I don't see any.
|
Wed Jan 14, 2015 2:09 am |
|
 |
akash329dsouza
Novice
Joined: Tue Dec 16, 2014 10:25 am Posts: 81
|
 Re: Way to Tell if SMUX is Not Responding? Battery Level?
Well on that page it showed a function to check for low batteries. That is built into the drivers.
_________________ Thanks!
|
Wed Jan 14, 2015 9:03 am |
|
 |
Synergists
Rookie
Joined: Mon Dec 15, 2014 12:46 am Posts: 19
|
 Re: Way to Tell if SMUX is Not Responding? Battery Level?
It actually is just a bool which means true or false. I was thinking of using one of those functions or bools, but I have to wait for electrical placement to be finalized and Saturday to write and test. I did write this to make sure that I can access the values of a bool, int. This will be the basis for MUX checking.
_________________ FTC 7104 - The Synergists
|
Wed Jan 14, 2015 3:17 pm |
|
 |
FTC_359
Rookie
Joined: Tue Jan 13, 2015 10:48 pm Posts: 23
|
 Re: Way to Tell if SMUX is Not Responding? Battery Level?
This is the function to read the battery level: It will return true if the battery level is low and false if it isn't. To check if the SMUX is connected, use the following code that I just parsed together: I will send you some actual code instead of that pseudo code once I test it out for myself tomorrow, as Hi-Technic has not said what the sensor type field should contain.
|
Thu Jan 15, 2015 2:14 am |
|
 |
MHTS
Guru
Joined: Sun Nov 15, 2009 5:46 am Posts: 1523
|
 Re: Way to Tell if SMUX is Not Responding? Battery Level?
Ah, I stand corrected. The functions indeed exist. That's good to know.
|
Thu Jan 15, 2015 2:30 am |
|
 |
FTC_359
Rookie
Joined: Tue Jan 13, 2015 10:48 pm Posts: 23
|
 Re: Way to Tell if SMUX is Not Responding? Battery Level?
I tested checking code today and found its sensor type ID. Use the following code to check if the SMUX is connected to the correct port.
|
Thu Jan 15, 2015 7:49 pm |
|
 |
akash329dsouza
Novice
Joined: Tue Dec 16, 2014 10:25 am Posts: 81
|
 Re: Way to Tell if SMUX is Not Responding? Battery Level?
Is that code complete? There isn't any {} for the if statements. Also could you give a example of using the fiction. Just want to make sure im setting it up right
_________________ Thanks!
|
Thu Jan 15, 2015 11:40 pm |
|
 |
FTC_359
Rookie
Joined: Tue Jan 13, 2015 10:48 pm Posts: 23
|
 Re: Way to Tell if SMUX is Not Responding? Battery Level?
Yes, the function is set up correctly. Should be included at the beginning of your code, directly after your #pragma initializations. An example usage with the sensor port name set as "SMUX" would be: There aren't any brackets for the if statements because if you are only using one line (function/command) that is related to an if function, the curly brackets are unnecessary; if your if statement contains two or more functions, use curly brackets ({}).
|
Fri Jan 16, 2015 12:26 am |
|
 |
akash329dsouza
Novice
Joined: Tue Dec 16, 2014 10:25 am Posts: 81
|
 Re: Way to Tell if SMUX is Not Responding? Battery Level?
How do you set the port name for the MUX? And thanks this is really helpful
_________________ Thanks!
|
Fri Jan 16, 2015 1:26 am |
|
 |
FTC_359
Rookie
Joined: Tue Jan 13, 2015 10:48 pm Posts: 23
|
 Re: Way to Tell if SMUX is Not Responding? Battery Level?
You would use the same name that you plug in to all of the other SMUX functions. It is the name that you use when you set up motors and sensors.
|
Fri Jan 16, 2015 1:37 am |
|
|