Skip to content

Commit

Permalink
Merge pull request #28 from BrianAdams/30.0.2
Browse files Browse the repository at this point in the history
30.0.2
  • Loading branch information
BrianAdams committed Aug 31, 2015
2 parents b62f5c4 + ed5b7d2 commit c4c954c
Show file tree
Hide file tree
Showing 22 changed files with 1,062 additions and 96 deletions.
6 changes: 2 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ script:
env:
global:
- ARDUINO_IDE_VERSION='1.0.5'
- VERSION_NUMBER="`cat package.json | grep version | grep -o '[0-9]\.[0-9]\.[0-9]\+'`"
- VERSION_NUMBER="`cat package.json | grep version | grep -o '.[0-9]\.[0-9]\.[0-9]\+'`"
- BUILD_NUMBER=$TRAVIS_BUILD_NUMBER
- secure: "P4i5RD2+chpGAPtkn1JYChOc+TVEHdHVVWA40uVAaHqRGm0I/kAvA2i4xXun0VAFFJJjQgC7BSdzQs9kP6IVu4x7VVXyOt3OYMql8ehsH6LU3Q476Rb+HIOzX30qYx+7F+cHUPFp/BTiyEJ+IOjU6sDTWLmSDpjUvVD2Tzg+PLI="
- REAL_GIT_BRANCH="`git for-each-ref --format='%(objectname) %(refname:short)' refs/heads
Expand All @@ -24,7 +24,7 @@ after_success:
- echo real_get_branch $REAL_GIT_BRANCH
- rm -rf OpenROV/build-*
- 'fpm -f -m [email protected] -s dir -t deb -a armhf -n openrov-arduino-firmware -v
$VERSION_NUMBER-$REAL_GIT_BRANCH.$BUILD_NUMBER.`git rev-parse --short HEAD` --description ''OpenROV Arduino Firmware'' .=/opt/openrov/arduino '
$VERSION_NUMBER~$BUILD_NUMBER.`git rev-parse --short HEAD` --description ''OpenROV Arduino Firmware'' .=/opt/openrov/arduino '
- mkdir build
- DEBFILE="`ls *.deb`"
- cp *.deb build/openrov-arduino-firmware_latest-${REAL_GIT_BRANCH}_armhf.deb
Expand All @@ -45,8 +45,6 @@ deploy:
repo: OpenROV/openrov-software-arduino
all_branches: true
condition: "($REAL_GIT_BRANCH = master )||($REAL_GIT_BRANCH = pre-release )||($REAL_GIT_BRANCH = stable)"
after_deploy:
- curl -g http://build.openrov.com:8080/job/OpenROV-generic-upload-deb-to-repo/buildWithParameters -d token=$JENKINS_TOKEN_NAME -d urlToDebPackage=http://openrov-software-nightlies.s3-website-us-west-2.amazonaws.com/arduino-firmware%2F$DEBFILE -d branch=$REAL_GIT_BRANCH

notifications:
webhooks:
Expand Down
8 changes: 7 additions & 1 deletion OpenROV/AConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,15 @@
//After Market:
#define HAS_POLOLU_MINIMUV (0)
#define HAS_MS5803_14BA (1)
#define MS5803_14BA_I2C_ADDRESS 0x76
#define HAS_MS5803_30BA (0)
#define MS5803___BA_I2C_ADDRESS 0x76
#define HAS_MPU9150 (1)
#define HAS_BNO055 (1)
#define MPU9150_EEPROM_START 2
#define HAS_ALT_SERVO (1)
#define ALTS_MIDPOINT 1500
#define ALTS_MINPOINT 1000
#define ALTS_MAXPOINT 2000

#if !(HAS_OROV_CONTROLLERBOARD_25) && !(HAS_STD_CAPE)
# error "You must select either standard cape or controllerboard25 in the AConfig.h file as they have predefined pin values required by other libraries."
Expand Down
45 changes: 45 additions & 0 deletions OpenROV/AltServo.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#include "AConfig.h"
#if(HAS_ALT_SERVO)
#include "Device.h"
#include "Pin.h"
#include "AltServo.h"
#include "Settings.h"
#include <Arduino.h>
#include "openrov_servo.h"
Servo _altservo;
int alts_val = ALTS_MIDPOINT;
int new_alts = ALTS_MIDPOINT;
int altsrate = 1;

int smoothAdjustedServo(int target, int current){
double x = target - current;
int sign = (x>0) - (x<0);
int adjustedVal = current + sign * (min(abs(target - current), altsrate));
return (adjustedVal);
}

void AltServo::device_setup(){
_altservo.attach(ALTSERVO_PIN);
_altservo.writeMicroseconds(ALTS_MIDPOINT);
Settings::capability_bitarray |= (1 << ALT_SERVO_CAPABLE);

}

void AltServo::device_loop(Command command){
if (command.cmp("asrt")) {
int ms = map(command.args[1],-100,100,ALTS_MINPOINT,ALTS_MAXPOINT);
if ((ms >= ALTS_MINPOINT) && (ms <= ALTS_MAXPOINT)){
alts_val = ms;
Serial.print("asr.t:");Serial.print(alts_val);Serial.println(";");
}
}
if (alts_val != new_alts){
new_alts = smoothAdjustedServo(alts_val,new_alts);
_altservo.writeMicroseconds(new_alts);
Serial.print("asr.v:");Serial.print(new_alts);Serial.println(";");
}


}

#endif
34 changes: 34 additions & 0 deletions OpenROV/AltServo.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@

#ifndef __ALTSERVO_H_
#define __ALTSERVO_H_
#include "AConfig.h"
#if(HAS_ALT_SERVO)
#include <Arduino.h>
#include "Device.h"
#include "Pin.h"

#ifndef ALTS_MIDPOINT
#define ALTS_MIDPOINT 1500
#endif
#ifndef ALTS_MINPOINT
#define ALTS_MINPOINT 1000
#endif
#ifndef ALTS_MAXPOINT
#define ALTS_MAXPOINT 2000
#endif
#if(HAS_STD_CAPE)
#include "Cape.h"
#endif

#if(HAS_OROV_CONTROLLERBOARD_25)
#include "controllerboard25.h"
#endif

class AltServo : public Device {
public:
AltServo():Device(){};
void device_setup();
void device_loop(Command cmd);
};
#endif
#endif
Loading

0 comments on commit c4c954c

Please sign in to comment.