-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
116 RC Threshold Calibration #131
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unsure about using FileSystem. I am pretty sure this creates a file within the Arduino's on board memory. Try this: https://electronics.stackexchange.com/questions/54/saving-arduino-sensor-data-to-a-text-file
Calibration_EEPROM.ino
Outdated
@@ -0,0 +1,100 @@ | |||
#include<EEPROM.h> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pls format using Ctrl + Shift + I
on vscode
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes yes
Calibration_EEPROM.ino
Outdated
|
||
//**********Right Joystick**********// | ||
//MAX Position | ||
Serial.println("Please move the right joystick to the maximum position\n"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you specificy that the maximum position is up (like forwards)
Calibration_EEPROM.ino
Outdated
rc2 = pulseIn(rc_channel2, HIGH); | ||
EEPROM.put(rc2_addr_max, rc2); | ||
//MIN Position | ||
Serial.println("Please move the right joystick to the minimum position\n"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
specify what the minimum position is
Calibration_EEPROM.ino
Outdated
|
||
//**********Switch A(Remote E-stop)**********// | ||
//Position 0 | ||
Serial.println("Please move Switch A to 0\n"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we need to label these on the RC itself somehow
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
agreed
Calibration_EEPROM.ino
Outdated
int switchB = 7; //Channel 6 | ||
|
||
//Address in EEPROM | ||
const int rc2_addr_max = 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
consider moving this pinout.h
and use #define instead
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
make this file pinout agnostic
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
e.g.
#@file pinout.h
#define RC_CHANNEL2 3
#define RC_CHANNEL3 4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Further, the EEPROM addresses need to be in a header file (e.g. eeprom_io.h
). This will need to be used by the main firware to read from these addresses. Don't define them as const int
s in the scope of this program.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See the comments I left.
Calibration_EEPROM.ino
Outdated
//**********Right Joystick**********// | ||
//MAX Position | ||
Serial.println("Please move the right joystick to the maximum position\n"); | ||
delay(2000); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't use delays. I suggest doing something like the following:
- Indicate which measurement.
- Wait for a start character.
- Record the values for 5 seconds or until the stop character is sent. This gives the user a small window to move the joystic. Note: I would suggest checking the data rate so a bunch of data is stored and possible lost. Maybe 2 seconds is good. Throughout this period, keep sampling.
- Find the max/min from the collected data and save the value to the EEPROM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest creating a seperate function for this with a few arguments:
int get_threshold(const char * user_question, bool min = false, bool max = false, bool mean = false, uint8_t rc_pin, uint8_t eeprom_addr)
{
/*
1.print the string
2.wait for a start char
3.sample and store into a temp array
4.wait for time end or end char. Or, cancel char which exits the measurement and re-runs the question routine.
5.get min/max/mean
6.write value to eeprom
7.return true is successful data collection and eeprom write, else false
*/
}
Calibration_EEPROM.ino
Outdated
int switchB = 7; //Channel 6 | ||
|
||
//Address in EEPROM | ||
const int rc2_addr_max = 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Further, the EEPROM addresses need to be in a header file (e.g. eeprom_io.h
). This will need to be used by the main firware to read from these addresses. Don't define them as const int
s in the scope of this program.
No description provided.