Parcourir la source

updated config

subDesTagesMitExtraKaese il y a 3 ans
Parent
commit
adb630e17d
2 fichiers modifiés avec 20 ajouts et 11 suppressions
  1. 15 6
      arduino/src/ultrasonic.cpp
  2. 5 5
      raspberry-pi/config.ini

+ 15 - 6
arduino/src/ultrasonic.cpp

@@ -52,20 +52,29 @@ void us_transmit() {
   delayMicroseconds(5);
   PORTD = (PORTD & 0b11100011) | 0b00001000;
   delayMicroseconds(5);
-  PORTD = (PORTD & 0b11100011) | 0b00010000;
-  delayMicroseconds(5);
 
-  //pull pin 2, 3 and 4 to GND
-  PORTD &= 0b11100011;
+  //pull pin 2 and 3 to GND
+  PORTD &= 0b11110011;
+  //set pin 2 and 3 back to input
+  DDRD  &= 0b11110011;
 
-  //set pin 2, 3 and 4 back to input
-  DDRD  &= 0b11100011;
+  delayMicroseconds(5);
 
   //enable pin interrupts
   EIMSK = _BV(INT1) | _BV(INT0);
 
   usData[0].state = rxPending;
   usData[1].state = rxPending;
+
+  PORTD = (PORTD & 0b11100011) | 0b00010000;
+  delayMicroseconds(5);
+
+  //pull pin 4 to GND
+  PORTD &= 0b11101111;
+
+  //set pin 4 back to input
+  DDRD  &= 0b11101111;
+
 } 
 
 long us_get_duration(byte sensor) {

+ 5 - 5
raspberry-pi/config.ini

@@ -2,9 +2,9 @@
 # size of the trackable area
 [field]
   # width in mm
-  x = 380
+  x = 390
   # height in mm
-  y = 380
+  y = 395
 
 [arduino]
   # leave port empty for auto config
@@ -27,12 +27,12 @@
 
   # default speed of sound in mm / us (or km / s)
   # only used before calibration
-  sonicspeed = 0.343
+  sonicspeed = 0.342
 
   # default arduino timing overhead in us
   # only used before calibration
-  overhead_left  = 200
-  overhead_right = 200
+  overhead_left  = 883
+  overhead_right = 979
 
 [mag_sensor]