Permalink
Browse files

0.11.3 patch release

  • Loading branch information...
vickash committed Aug 19, 2013
1 parent 298ae0a commit 65b9c436a28b8455fcea76e0fa9f3f5710849bf3
Showing with 20 additions and 22 deletions.
  1. +5 −0 CHANGELOG.md
  2. +1 −1 README.md
  3. +8 −15 lib/dino/tx_rx/base.rb
  4. +6 −6 src/lib/Dino.cpp
View
@@ -1,5 +1,10 @@
# Changelog
+## 0.11.3
+* Backport bug fixes from 0.12:
+ * Listeners weren't working properly on the Arduino MEGA.
+ * More reliable handshake.
+
## 0.11.2
* Make servos work better by using the existing Arduino Servo library.
View
@@ -1,4 +1,4 @@
-# Dino 0.11.2
+# Dino 0.11.3
[![Build Status](https://secure.travis-ci.org/austinbv/dino.png)](http://travis-ci.org/austinbv/dino)
## Get Started In No Time
View
@@ -34,19 +34,12 @@ def write(message)
end
def handshake
- flush_read
- 100.times do
- begin
- write("!9000000.")
- Timeout::timeout(0.1) do
- line = gets.to_s
- if line.match /ACK:/
- flush_read
- return line.chop.split(/:/)[1].to_i
- end
- end
- rescue
- nil
+ 10.times do
+ write("!9000000.")
+ line = gets(1)
+ if line && line.match(/ACK:/)
+ flush_read
+ return line.chop.split(/:/)[1].to_i
end
end
raise BoardNotFound
@@ -56,8 +49,8 @@ def flush_read
gets until gets == nil
end
- def gets
- IO.select([io], nil, nil, 0.005) && io.gets
+ def gets(timeout=0.005)
+ IO.select([io], nil, nil, timeout) && io.gets
end
end
end
View
@@ -82,7 +82,7 @@ void Dino::updateListeners() {
}
}
void Dino::updateDigitalListeners() {
- for (int i = 0; i < 22; i++) {
+ for (int i = 0; i < PIN_COUNT; i++) {
if (digitalListeners[i]) {
pin = i;
dRead();
@@ -94,7 +94,7 @@ void Dino::updateDigitalListeners() {
}
}
void Dino::updateAnalogListeners() {
- for (int i = 0; i < 22; i++) {
+ for (int i = 0; i < PIN_COUNT; i++) {
if (analogListeners[i]) {
pin = i;
aRead();
@@ -225,13 +225,13 @@ void Dino::reset() {
heartRate = 4000; // Default heartRate is ~4ms.
loopCount = 0;
analogDivider = 4; // Update analog listeners every ~16ms.
- for (int i = 0; i < 22; i++) digitalListeners[i] = false;
- for (int i = 0; i < 22; i++) digitalListenerValues[i] = 2;
- for (int i = 0; i < 22; i++) analogListeners[i] = false;
+ for (int i = 0; i < PIN_COUNT; i++) digitalListeners[i] = false;
+ for (int i = 0; i < PIN_COUNT; i++) digitalListenerValues[i] = 2;
+ for (int i = 0; i < PIN_COUNT; i++) analogListeners[i] = false;
lastUpdate = micros();
index = 0;
#ifdef debug
- Serial.println("Reset the board to defaults. pin ");
+ Serial.println("Reset the board to defaults.");
#endif
sprintf(response, "ACK:%02d", A0);
}

0 comments on commit 65b9c43

Please sign in to comment.