Skip to content

Commit d3b05fc

Browse files
authored
Add files via upload
1 parent 9ddcd14 commit d3b05fc

1 file changed

Lines changed: 8 additions & 18 deletions

File tree

src/Force.cpp

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ void Force::run() {
4444
// TaskFunctions
4545
/////////////////////////////////////////////////////////////////////////
4646
void Force::Dispense() {
47-
dispensing = true;
4847
trial++;
4948
// Tone();
5049
float successTime = millis();
@@ -54,6 +53,7 @@ void Force::Dispense() {
5453
tft.print("Delay:");
5554
tft.setTextColor(ST7735_WHITE);
5655
tft.print((-(millis() - successTime - (dispense_delay*1000))/ 1000),1);
56+
tft.print("s");
5757
run();
5858
tft.fillRect(84, 43, 80, 12, ST7735_BLACK); // remove Delay text when timeout is over
5959
if (grams > 1 or grams2 >1){ //only clear F1 ans F2 values if levers are being pushed
@@ -71,7 +71,7 @@ void Force::Dispense() {
7171
digitalWrite(13, LOW); // RED LED
7272
pressTime = millis();
7373
pressLength = 0;
74-
dispensing = false;
74+
Timeout(timeout_length);
7575
}
7676

7777
void Force::Timeout(int timeout_length) {
@@ -81,8 +81,9 @@ void Force::Timeout(int timeout_length) {
8181
tft.setTextColor(ST7735_WHITE);
8282
tft.print("Timeout:");
8383
tft.print((-(millis() - dispense_time - (timeout_length*1000))/ 1000),1);
84+
tft.print("s");
8485
run();
85-
tft.fillRect(84, 43, 80, 12, ST7735_BLACK);
86+
tft.fillRect(84, 43, 80, 12, ST7735_BLACK);
8687
if ((grams > 1.5) or (grams2 > 1.5)) { //reset timeout if either lever pushed
8788
Timeout(timeout_length);
8889
tft.fillRect(12, 0, 38, 24, ST7735_BLACK); // clear the text after F1 F2 labels
@@ -474,10 +475,11 @@ void Force::graphLegend() {
474475
tft.setTextColor(ST7735_WHITE);
475476
tft.setCursor(0, 28);
476477
tft.print ("Lick");
478+
digitalWrite(A3, HIGH);
477479
DateTime now = rtc.now();
478480
lickTime = now.unixtime();
479481
}
480-
482+
digitalWrite(A3, LOW);
481483
if (calibrated == false){
482484
tft.setCursor(85, 56);
483485
tft.print ("Uncalibrated");
@@ -509,7 +511,7 @@ void Force::CreateDataFile() {
509511

510512
// Write data header to file of uSD.
511513
void Force::writeHeader() {
512-
logfile.println("MM:DD:YYYY hh:mm:ss, Seconds, Device_Number, ProgressiveRatio, Grams_req, Hold_time, Ratio, Dispense_amount, Dispense_delay, Timeout, Trials_per_block, Max_force, Trial, Press, Lever1_Grams, Lever2_Grams, Licks, Dispense, Random_Num, Shock_trial");
514+
logfile.println("MM:DD:YYYY hh:mm:ss, Seconds, Device_Number, ProgressiveRatio, Grams_req, Hold_time, Ratio, Dispense_amount, Dispense_delay, Timeout, Trials_per_block, Max_force, Trial, Lever1_Grams, Lever2_Grams, Licks");
513515
}
514516

515517
// Print data and time followed by pellet count and motorturns to SD card
@@ -569,25 +571,13 @@ void Force::WriteToSD() {
569571
logfile.print(trial);
570572
logfile.print(",");
571573

572-
logfile.print(presses);
573-
logfile.print(",");
574-
575574
logfile.print(grams);
576575
logfile.print(",");
577576

578577
logfile.print(grams2);
579578
logfile.print(",");
580579

581-
logfile.print(lick);
582-
logfile.print(",");
583-
584-
logfile.print(dispensing);
585-
logfile.print(",");
586-
587-
logfile.print(random_number);
588-
logfile.print(",");
589-
590-
logfile.println(shock);
580+
logfile.println(lick);
591581

592582
logfile.flush();
593583

0 commit comments

Comments
 (0)