Skip to content

Commit

Permalink
Merge remote-tracking branch 'refs/remotes/origin/development2'
Browse files Browse the repository at this point in the history
# Conflicts:
#	Mechaduino_01/Mechaduino_01/Mechaduino_01.ino
  • Loading branch information
jcchurch13 committed Nov 29, 2016
2 parents f8fd951 + 202251c commit 9105d2b
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 12 deletions.
6 changes: 5 additions & 1 deletion Mechaduino_01/Mechaduino_01/Mechaduino_01.ino
Original file line number Diff line number Diff line change
Expand Up @@ -52,17 +52,21 @@ void setup() {
digitalWrite(13,HIGH); //turn LED on
setupPins();
setupTCInterrupts();
<<<<<<< HEAD
sineGen();
stepNumber = 0; //this fixes a memory bug.... better fix coming soon.


=======

>>>>>>> refs/remotes/origin/development2
SerialUSB.begin(115200);
delay(3000); //This delay seems to make it easier to establish a connection when the Mechaduino is configured to start in closed loop mode.
serialMenu();
setupSPI();
digitalWrite(13,LOW); //turn LED off

pinMode(3, OUTPUT); //for debugging control loop timing on pin 3
pinMode(3, OUTPUT); //for debugging control loop timing on pin 3


// enableTCInterrupts(); //start in closed loop mode
Expand Down
9 changes: 7 additions & 2 deletions Mechaduino_01/Mechaduino_01/Parameters.cpp

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions Mechaduino_01/Mechaduino_01/Parameters.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ extern const int dir_pin;

extern const PROGMEM float force_lookup[];

//extern int sin_1[3600];
extern int sin_1[3600];

extern const int sin_1[];

#endif

24 changes: 17 additions & 7 deletions Mechaduino_01/Mechaduino_01/Utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,10 @@ void serialCheck() { //Monitors serial for commands. Must be called in r
case 'k':
parameterEditmain();
break;

case 'g':
sineGen();
break;

case 'm':
serialMenu();
Expand Down Expand Up @@ -977,20 +981,26 @@ void serialMenu() {
SerialUSB.println("");
SerialUSB.println(" j - step response");
SerialUSB.println(" k - edit controller gains");
SerialUSB.println(" g - generate sine commutation table");
SerialUSB.println(" m - print main menu");
// SerialUSB.println(" f - get max loop frequency");
SerialUSB.println("");
}
void sineGen() {
int temp;
SerialUSB.println("");
SerialUSB.println("The sineGen() function in Utils.cpp generates a sinusoidal commutation table.");
SerialUSB.println("You can experiment with different commutation profiles by modifying this table.");
SerialUSB.println("The below table should be copied into sine_1 in Parameters.cpp.");
SerialUSB.println("");
delay(3000);
SerialUSB.println("Printing sine look up table:...");
SerialUSB.println("");
for (int x = 0; x <= 3600; x++) {
sin_1[x] = round(1024.0 * sin((3.14159265358979 * ((x * 0.1 / 180.0) + 0.25))));
// sin_2[x] = round(1024.0 * sin((3.14159265358979 * ((x * 0.1 / 180.0) + 0.75))));
temp = round(1024.0 * sin((3.14159265358979 * ((x * 0.1 / 180.0) + 0.25))));
SerialUSB.print(temp);
SerialUSB.print(", ");
}
// for (int x = 0; x<=3600;x++){ //print out commutation table
// SerialUSB.println(sin_1[x]);
// SerialUSB.print(",");
// SerialUSB.print(sin_2[x]);
// }

}

Expand Down

0 comments on commit 9105d2b

Please sign in to comment.