From a26886e139ccb1b70b709e4c4e02b920d57fdff2 Mon Sep 17 00:00:00 2001
From: Jason Kridner <jdk@ti.com>
Date: Thu, 18 Jun 2020 00:44:00 -0400
Subject: [PATCH 01/13] Use latest aliases for pru remoteproc interface

Depends on https://github.com/beagleboard/customizations/commit/d9659ecd38f87feafb40e735c883fa33278e4dcd

Fixes https://github.com/beagleboard/librobotcontrol/issues/180

This first seen as https://github.com/beagleboard/Latest-Images/issues/23

This is understood to have been caused by setting remoteproc to be a
module:

https://github.com/beagleboard/linux/commit/905625c9cf2b7b1b4666c9d539f7e9b631fcc6e1#diff-33a10e3332c04ed8bae3a266caa5c723R2027

Whereas it use to be a built-in:

https://github.com/beagleboard/linux/commit/2a8a6a110c8348dcf4e67ce358044ce62bfe175d#diff-33a10e3332c04ed8bae3a266caa5c723R2040

Although, mainline has disabled module based remoteproc builds for now,
so indexes will likely change again:

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=6334150e9a36467e253371c923a23955c831a295

Fortunately, with the new udev rule, we should be immune unless we
actually decide to change the name ourselves.
---
 debian/changelog                               | 5 +++++
 debian/control                                 | 8 ++++----
 examples/src/rc_test_drivers.c                 | 2 +-
 library/src/pru/pru.c                          | 8 ++++----
 services/robotcontrol/src/rc_startup_routine.c | 2 +-
 5 files changed, 15 insertions(+), 10 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 24b41de..384ad25 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,8 @@
+librobotcontrol (1.0.5) stable; urgency=high
+    * use latest aliases for PRU indexes
+ -- Jason Kridner <jkridner@beagleboard.org>  Thu, 18 Jun 2020 00:17:41 -0400
+
+
 librobotcontrol (1.0.4) stable; urgency=low
     * fix missing stddef.h include in i2c.h
     * add kmartin36's PRU encoder robustness improvement
diff --git a/debian/control b/debian/control
index e401677..d7ac3e8 100644
--- a/debian/control
+++ b/debian/control
@@ -3,14 +3,14 @@ Section: utils
 Priority: optional
 Build-Depends: debhelper (>= 9), devscripts, debconf (>= 0.2.26)
 Standards-Version: 3.9.8
-Maintainer: James Strawson <james@strawsondesign.com>
-Homepage: http://www.strawsondesign.com/
+Maintainer: Jason Kridner <jkridner@beagleboard.org>
+Homepage: http://beagleboard.org/librobotcontrol
 
 Package: librobotcontrol
 Architecture: any
-Depends: debconf, ${shlibs:Depends}, ${misc:Depends}
+Depends: debconf, bb-customizations (>= 1.20200522.1-0), ${shlibs:Depends}, ${misc:Depends}
 Replaces: roboticscape
 Conflicts: roboticscape
 Provides: roboticscape
 Description: Robot Control Library and Examples
- Hardware support for the Robotics Cape and BeagleBone Blue.
+ Hardware support for BeagleBoard.org Robotics Cape and BeagleBoard.org BeagleBone Blue.
diff --git a/examples/src/rc_test_drivers.c b/examples/src/rc_test_drivers.c
index 22592c8..eabb3ff 100644
--- a/examples/src/rc_test_drivers.c
+++ b/examples/src/rc_test_drivers.c
@@ -65,7 +65,7 @@ int main()
 	} else printf("PASSED: eqep2\n");
 
 	// rproc
-	if(access("/sys/class/remoteproc/remoteproc1/state", F_OK ) != 0){
+	if(access("/dev/remoteproc/pruss-core0/state", F_OK ) != 0){
 		printf("ERROR:  pru-rproc driver not loaded\n");
 	} else printf("PASSED: pru-rproc\n");
 
diff --git a/library/src/pru/pru.c b/library/src/pru/pru.c
index b7ec26f..c7f41b9 100644
--- a/library/src/pru/pru.c
+++ b/library/src/pru/pru.c
@@ -22,10 +22,10 @@
 #include <rc/pru.h>
 
 // remoteproc driver
-#define PRU0_STATE	"/sys/class/remoteproc/remoteproc1/state"
-#define PRU1_STATE	"/sys/class/remoteproc/remoteproc2/state"
-#define PRU0_FW		"/sys/class/remoteproc/remoteproc1/firmware"
-#define PRU1_FW		"/sys/class/remoteproc/remoteproc2/firmware"
+#define PRU0_STATE	"/dev/remoteproc/pruss-core0/state"
+#define PRU1_STATE	"/dev/remoteproc/pruss-core1/state"
+#define PRU0_FW		"/dev/remoteproc/pruss-core0/firmware"
+#define PRU1_FW		"/dev/remoteproc/pruss-core1/firmware"
 
 // share memory pointer location
 #define PRU_ADDR	0x4A300000	// Start of PRU memory Page 184 am335x TRM
diff --git a/services/robotcontrol/src/rc_startup_routine.c b/services/robotcontrol/src/rc_startup_routine.c
index 8bd9a81..4d04d6e 100644
--- a/services/robotcontrol/src/rc_startup_routine.c
+++ b/services/robotcontrol/src/rc_startup_routine.c
@@ -224,7 +224,7 @@ int check_eqep()
  */
 int check_pru()
 {
-	if(access("/sys/class/remoteproc/remoteproc1/state", F_OK)){
+	if(access("/dev/remoteproc/pruss-core0", F_OK)){
 		return -1;
 	}
 	return 0;
-- 
GitLab


From d7e49b903cb312553b0bb6af4b5b5790c5fc82cb Mon Sep 17 00:00:00 2001
From: Jason Kridner <jdk@ti.com>
Date: Thu, 18 Jun 2020 19:52:08 +0000
Subject: [PATCH 02/13] bump version to 1.0.4

---
 CHANGELOG                    | 5 ++++-
 debian/changelog             | 2 +-
 library/Makefile             | 2 +-
 library/include/rc/version.h | 4 ++--
 4 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/CHANGELOG b/CHANGELOG
index 2ee23a6..9397829 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,3 +1,6 @@
+1.0.5
+    * use latest aliases for PRU indexes
+
 1.0.4
     * fix missing stddef.h include in i2c.h
     * add kmartin36's PRU encoder robustness improvement
@@ -187,4 +190,4 @@
 0.1.0
     * installs on Blue as well and Black
 
-// indentation is with spaces to allow copy/paste into debian/changelog
\ No newline at end of file
+// indentation is with spaces to allow copy/paste into debian/changelog
diff --git a/debian/changelog b/debian/changelog
index 384ad25..8a34bf5 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,4 +1,4 @@
-librobotcontrol (1.0.5) stable; urgency=high
+librobotcontrol (1.0.5) stable; urgency=low
     * use latest aliases for PRU indexes
  -- Jason Kridner <jkridner@beagleboard.org>  Thu, 18 Jun 2020 00:17:41 -0400
 
diff --git a/library/Makefile b/library/Makefile
index 1a4fa71..7393b3c 100644
--- a/library/Makefile
+++ b/library/Makefile
@@ -5,7 +5,7 @@ BUILDDIR	:= build
 INCLUDEDIR	:= include
 SHORTNAME	:= librobotcontrol.so
 SONAME		:= librobotcontrol.so.1
-FULLNAME	:= librobotcontrol.so.1.0.4
+FULLNAME	:= librobotcontrol.so.1.0.5
 TARGET		:= $(LIBDIR)/$(FULLNAME)
 RC_VAR_DIR	:= var/lib/robotcontrol
 
diff --git a/library/include/rc/version.h b/library/include/rc/version.h
index 020a798..fc29a1b 100644
--- a/library/include/rc/version.h
+++ b/library/include/rc/version.h
@@ -20,7 +20,7 @@ extern "C" {
 
 #define RC_LIB_VERSION_MAJOR	1
 #define RC_LIB_VERSION_MINOR	0
-#define RC_LIB_VERSION_PATCH	4
+#define RC_LIB_VERSION_PATCH	5
 #define RC_LIB_VERSION_HEX	((RC_LIB_VERSION_MAJOR << 16) | \
 				 (RC_LIB_VERSION_MINOR <<  8) | \
 				 (RC_LIB_VERSION_PATCH))
@@ -58,4 +58,4 @@ void rc_version_print(void);
 
 #endif //RC_VERSION_H
 
-/** @} end group version*/
\ No newline at end of file
+/** @} end group version*/
-- 
GitLab


From 2c6c17e44194b2c12e0099a8887bef680f346451 Mon Sep 17 00:00:00 2001
From: "Mark A. Yoder" <Mark.A.Yoder@Rose-Hulman.edu>
Date: Wed, 17 Jun 2020 15:30:42 -0400
Subject: [PATCH 03/13] On pocket, motor 1 uses PWM 1A and motor 2 uses PWM 0A

---
 library/src/motor.c | 20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)

diff --git a/library/src/motor.c b/library/src/motor.c
index cf30b0d..1170268 100644
--- a/library/src/motor.c
+++ b/library/src/motor.c
@@ -14,6 +14,9 @@
 #define unlikely(x)	__builtin_expect (!!(x), 0)
 
 // motor pin definitions
+#define MDIR0A_CHIP		0	//gpio0.26	P1.34
+#define MDIR0A_PIN		26	//gpio0.26	P1.34
+
 #define MDIR1A_CHIP		1	//gpio1.28	P9.12
 #define MDIR1A_PIN		28	//gpio1.28	P9.12
 #define MDIR1A_CHIP_BLUE	2	//gpio2.0	pin T13
@@ -94,8 +97,16 @@ int rc_motor_init_freq(int pwm_frequency_hz)
 		dirB_chip[1] = MDIR2B_CHIP;
 		dirB_pin[1] = MDIR2B_PIN;
 	}
-	pwmss[1]=1;
-	pwmch[1]='B';
+	if(rc_model()==MODEL_BB_POCKET) {
+		printf("Found Pocket\n");
+		dirA_chip[1]=MDIR0A_CHIP;
+		dirA_pin[1]=MDIR0A_PIN;
+		pwmss[1]=0;
+		pwmch[1]='A';
+	} else {
+		pwmss[1]=1;
+		pwmch[1]='B';
+	}
 
 	// motor 3
 	dirA_chip[2]=MDIR3A_CHIP;
@@ -114,6 +125,10 @@ int rc_motor_init_freq(int pwm_frequency_hz)
 	pwmch[3]='B';
 
 	// set up pwm channels
+	if(unlikely(rc_pwm_init(0,pwm_frequency_hz))){
+		fprintf(stderr,"ERROR in rc_motor_init, failed to initialize pwm subsystem 1\n");
+		return -1;
+	}
 	if(unlikely(rc_pwm_init(1,pwm_frequency_hz))){
 		fprintf(stderr,"ERROR in rc_motor_init, failed to initialize pwm subsystem 1\n");
 		return -1;
@@ -165,6 +180,7 @@ int rc_motor_cleanup(void)
 	int i;
 	if(!init_flag) return 0;
 	rc_motor_free_spin(0);
+	rc_pwm_cleanup(0);
 	rc_pwm_cleanup(1);
 	rc_pwm_cleanup(2);
 	rc_gpio_cleanup(MOT_STBY);
-- 
GitLab


From 4fefe0c946bb17e91fdaa43fa4c1c498a1136282 Mon Sep 17 00:00:00 2001
From: "Mark A. Yoder" <Mark.A.Yoder@Rose-Hulman.edu>
Date: Thu, 18 Jun 2020 15:06:47 -0400
Subject: [PATCH 04/13] Dropped eQEP1 on Pocket

---
 library/src/io/encoder_eqep.c | 43 +++++++++++++++++++----------------
 1 file changed, 23 insertions(+), 20 deletions(-)

diff --git a/library/src/io/encoder_eqep.c b/library/src/io/encoder_eqep.c
index 52894a6..b2724ee 100644
--- a/library/src/io/encoder_eqep.c
+++ b/library/src/io/encoder_eqep.c
@@ -12,6 +12,7 @@
 #include <fcntl.h> // for open
 #include <unistd.h> // for close
 
+#include <rc/model.h>
 #include <rc/encoder_eqep.h>
 
 // preposessor macros
@@ -60,26 +61,28 @@ int rc_encoder_eqep_init(void)
 	fd[0]=temp_fd;
 
 	// subsystem 1
-	temp_fd = open(EQEP_BASE1 "/enabled", O_WRONLY);
-	if(temp_fd<0){
-		perror("ERROR in rc_encoder_eqep_init, failed to open device driver");
-		fprintf(stderr,"Perhaps kernel or device tree is too old\n");
-		return -1;
-	}
-	if(write(temp_fd,"1",2)==-1){
-		perror("ERROR in rc_encoder_eqep_init, failed to enable device driver");
-		return -1;
-	}
-	close(temp_fd);
-	temp_fd = open(EQEP_BASE1 "/position", O_RDWR);
-	if(temp_fd<0){
-		perror("ERROR in rc_encoder_eqep_init, failed to open device driver");
-		fprintf(stderr,"Perhaps kernel or device tree is too old\n");
-		return -1;
-	}
-	if(write(temp_fd,"0",2)==-1){
-		perror("ERROR in rc_encoder_eqep_init, failed to zero out position");
-		return -1;
+	if(rc_model()!=MODEL_BB_POCKET) { // Skip since not enabled on Pocket
+		temp_fd = open(EQEP_BASE1 "/enabled", O_WRONLY);
+		if(temp_fd<0){
+			perror("ERROR in rc_encoder_eqep_init, failed to open device driver");
+			fprintf(stderr,"Perhaps kernel or device tree is too old\n");
+			return -1;
+		}
+		if(write(temp_fd,"1",2)==-1){
+			perror("ERROR in rc_encoder_eqep_init, failed to enable device driver");
+			return -1;
+		}
+		close(temp_fd);
+		temp_fd = open(EQEP_BASE1 "/position", O_RDWR);
+		if(temp_fd<0){
+			perror("ERROR in rc_encoder_eqep_init, failed to open device driver");
+			fprintf(stderr,"Perhaps kernel or device tree is too old\n");
+			return -1;
+		}
+		if(write(temp_fd,"0",2)==-1){
+			perror("ERROR in rc_encoder_eqep_init, failed to zero out position");
+			return -1;
+		}
 	}
 	fd[1]=temp_fd;
 
-- 
GitLab


From bcef727f1bb29fb38b52c97cee53bd7eff35a890 Mon Sep 17 00:00:00 2001
From: Jason Kridner <jdk@ti.com>
Date: Thu, 18 Jun 2020 20:33:34 +0000
Subject: [PATCH 05/13] motors.c: fix for PocketBeagle

Pin assignments for motors loaded to
https://docs.google.com/spreadsheets/d/1fE-AsDZvJ-bBwzNBj1_sPDrutvEvsmARqFwvbw_HkrE/edit?usp=sharing
---
 library/src/motor.c | 69 +++++++++++++++++++++++++++------------------
 1 file changed, 42 insertions(+), 27 deletions(-)

diff --git a/library/src/motor.c b/library/src/motor.c
index 1170268..b2585ab 100644
--- a/library/src/motor.c
+++ b/library/src/motor.c
@@ -14,22 +14,23 @@
 #define unlikely(x)	__builtin_expect (!!(x), 0)
 
 // motor pin definitions
-#define MDIR0A_CHIP		0	//gpio0.26	P1.34
-#define MDIR0A_PIN		26	//gpio0.26	P1.34
-
-#define MDIR1A_CHIP		1	//gpio1.28	P9.12
-#define MDIR1A_PIN		28	//gpio1.28	P9.12
+#define MDIR1A_CHIP		1	//gpio1.28	P9.12/P2.08
+#define MDIR1A_PIN		28	//gpio1.28	P9.12/P2.08
 #define MDIR1A_CHIP_BLUE	2	//gpio2.0	pin T13
 #define MDIR1A_PIN_BLUE		0	//gpio2.0	pin T13
-#define MDIR1B_CHIP		0	//gpio0.31	P9.13
-#define MDIR1B_PIN		31	//gpio0.31	P9.13
+#define MDIR1B_CHIP		0	//gpio0.31	P9.13/P2.07
+#define MDIR1B_PIN		31	//gpio0.31	P9.13/P2.07
 
 #define MDIR2A_CHIP		1	//gpio1.16	P9.15
 #define MDIR2A_PIN		16	//gpio1.16	P9.15
+#define MDIR2A_CHIP_POCKET	0	//gpio0.26	P1.34
+#define MDIR2A_PIN_POCKET	26	//gpio0.26	P1.34
 #define MDIR2B_CHIP		2	//gpio2.17	P8.34
 #define MDIR2B_PIN		17	//gpio2.17	P8.34
 #define MDIR2B_CHIP_BLUE	0	//gpio0.10	P8_31
 #define MDIR2B_PIN_BLUE		10	//gpio0.10	P8_31
+#define MDIR2B_CHIP_POCKET	1	//gpio1.27	P2.02
+#define MDIR2B_PIN_POCKET	27	//gpio1.27	P2.02
 
 #define MDIR3B_CHIP		2	//gpio2.8	P8.43
 #define MDIR3B_PIN		8	//gpio2.8	P8.43
@@ -41,9 +42,10 @@
 #define MDIR4B_CHIP		2	//gpio2.7	P8.46
 #define MDIR4B_PIN		7	//gpio2.7	P8.46
 
-#define MOT_STBY		0,20	//gpio0.20	P9.41
+#define MOT_STBY		0,20	//gpio0.20	P9.41/P1.20
 
 #define CHANNELS		4
+#define CHANNELS_POCKET		2
 
 
 // polarity of the motor connections
@@ -57,7 +59,7 @@ static int dirB_chip[CHANNELS];
 static int dirB_pin[CHANNELS];
 static int pwmss[CHANNELS];
 static int pwmch[CHANNELS];
-
+static int channels = 0;
 
 
 
@@ -71,8 +73,15 @@ int rc_motor_init_freq(int pwm_frequency_hz)
 {
 	int i;
 
+	if(rc_model()==MODEL_BB_POCKET){
+		channels = CHANNELS_POCKET;
+	}
+	else{
+		channels = CHANNELS;
+	}
+
 	// set pins for motor 1
-	// assign gpio pins for blue/black
+	// assign gpio pins for blue/black/pocket
 	if(rc_model()==MODEL_BB_BLUE){
 		dirA_chip[0]=MDIR1A_CHIP_BLUE;
 		dirA_pin[0]=MDIR1A_PIN_BLUE;
@@ -87,20 +96,26 @@ int rc_motor_init_freq(int pwm_frequency_hz)
 	pwmch[0]='A';
 
 	// motor 2
-	dirA_chip[1]=MDIR2A_CHIP;
-	dirA_pin[1]=MDIR2A_PIN;
+	if(rc_model()==MODEL_BB_POCKET) {
+		dirA_chip[1]=MDIR2A_CHIP_POCKET;
+		dirA_pin[1]=MDIR2A_PIN_POCKET;
+	}
+	else{
+		dirA_chip[1]=MDIR2A_CHIP;
+		dirA_pin[1]=MDIR2A_PIN;
+	}
 	if(rc_model()==MODEL_BB_BLUE){
 		dirB_chip[1]=MDIR2B_CHIP_BLUE;
 		dirB_pin[1]=MDIR2B_PIN_BLUE;
 	}
+	else if(rc_model()==MODEL_BB_POCKET) {
+		dirB_chip[1]=MDIR2B_CHIP_POCKET;
+		dirB_pin[1]=MDIR2B_PIN_POCKET;
 	else{
 		dirB_chip[1] = MDIR2B_CHIP;
 		dirB_pin[1] = MDIR2B_PIN;
 	}
 	if(rc_model()==MODEL_BB_POCKET) {
-		printf("Found Pocket\n");
-		dirA_chip[1]=MDIR0A_CHIP;
-		dirA_pin[1]=MDIR0A_PIN;
 		pwmss[1]=0;
 		pwmch[1]='A';
 	} else {
@@ -143,7 +158,7 @@ int rc_motor_init_freq(int pwm_frequency_hz)
 		fprintf(stderr,"ERROR in rc_motor_init, failed to set up gpio %d,%d\n", MOT_STBY);
 		return -1;
 	}
-	for(i=0;i<CHANNELS;i++){
+	for(i=0;i<channels;i++){
 		if(unlikely(rc_gpio_init(dirA_chip[i],dirA_pin[i], GPIOHANDLE_REQUEST_OUTPUT))){
 			fprintf(stderr,"ERROR in rc_motor_init, failed to set up gpio %d,%d\n", dirA_chip[i],dirA_pin[i]);
 			return -1;
@@ -184,7 +199,7 @@ int rc_motor_cleanup(void)
 	rc_pwm_cleanup(1);
 	rc_pwm_cleanup(2);
 	rc_gpio_cleanup(MOT_STBY);
-	for(i=0;i<CHANNELS;i++){
+	for(i=0;i<channels;i++){
 		rc_gpio_cleanup(dirA_chip[i],dirA_pin[i]);
 		rc_gpio_cleanup(dirB_chip[i],dirB_pin[i]);
 	}
@@ -224,8 +239,8 @@ int rc_motor_set(int motor, double duty)
 	int a,b,i;
 
 	// sanity checks
-	if(unlikely(motor<0 || motor>CHANNELS)){
-		fprintf(stderr,"ERROR in rc_motor_set, motor argument must be between 0 & %d\n", CHANNELS);
+	if(unlikely(motor<0 || motor>channels)){
+		fprintf(stderr,"ERROR in rc_motor_set, motor argument must be between 0 & %d\n", channels);
 		return -1;
 	}
 	if(unlikely(init_flag==0)){
@@ -238,7 +253,7 @@ int rc_motor_set(int motor, double duty)
 	else if	(duty <-1.0)	duty =-1.0;
 
 	if(motor==0){
-		for(i=1;i<CHANNELS;i++){
+		for(i=1;i<channels;i++){
 			if(rc_motor_set(i,duty)==-1) return -1;
 		}
 		return 0;
@@ -271,8 +286,8 @@ int rc_motor_free_spin(int motor)
 	int i;
 
 	// sanity checks
-	if(unlikely(motor<0 || motor>CHANNELS)){
-		fprintf(stderr,"ERROR in rc_motor_free_spin, motor argument must be between 0 & %d\n", CHANNELS);
+	if(unlikely(motor<0 || motor>channels)){
+		fprintf(stderr,"ERROR in rc_motor_free_spin, motor argument must be between 0 & %d\n", channels);
 		return -1;
 	}
 	if(unlikely(init_flag==0)){
@@ -282,7 +297,7 @@ int rc_motor_free_spin(int motor)
 
 	// case for all channels
 	if(motor==0){
-		for(i=1;i<CHANNELS;i++){
+		for(i=1;i<channels;i++){
 			if(rc_motor_free_spin(i)==-1) return -1;
 		}
 		return 0;
@@ -310,8 +325,8 @@ int rc_motor_brake(int motor)
 	int i;
 
 	// sanity checks
-	if(unlikely(motor<0 || motor>CHANNELS)){
-		fprintf(stderr,"ERROR in rc_motor_brake, motor argument must be between 0 & %d\n", CHANNELS);
+	if(unlikely(motor<0 || motor>channels)){
+		fprintf(stderr,"ERROR in rc_motor_brake, motor argument must be between 0 & %d\n", channels);
 		return -1;
 	}
 	if(unlikely(init_flag==0)){
@@ -321,7 +336,7 @@ int rc_motor_brake(int motor)
 
 	// case for all channels
 	if(motor==0){
-		for(i=1;i<CHANNELS;i++){
+		for(i=1;i<channels;i++){
 			if(rc_motor_brake(i)==-1) return -1;
 		}
 		return 0;
@@ -341,4 +356,4 @@ int rc_motor_brake(int motor)
 		return -1;
 	}
 	return 0;
-}
\ No newline at end of file
+}
-- 
GitLab


From c123a2f55022a0b2651244e7dd13675203e2a348 Mon Sep 17 00:00:00 2001
From: Jason Kridner <jdk@ti.com>
Date: Thu, 18 Jun 2020 20:48:49 +0000
Subject: [PATCH 06/13] Update CHANGELOG

---
 CHANGELOG        | 7 +++++++
 debian/changelog | 7 +++++++
 2 files changed, 14 insertions(+)

diff --git a/CHANGELOG b/CHANGELOG
index 9397829..489106b 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,5 +1,12 @@
 1.0.5
     * use latest aliases for PRU indexes
+    * add support for PocketBeagle
+    * integrate PX4 build handling
+    * clean-up some messages from rc_balance
+    * fix rc_startup_routine start delay
+    * fix rc_filter_duplicate initialization check
+    * fix stdin control mode for rc_balance
+    * add PRU to startup routine checks and required kernel modules
 
 1.0.4
     * fix missing stddef.h include in i2c.h
diff --git a/debian/changelog b/debian/changelog
index 8a34bf5..7d9c089 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,5 +1,12 @@
 librobotcontrol (1.0.5) stable; urgency=low
     * use latest aliases for PRU indexes
+    * add support for PocketBeagle
+    * integrate PX4 build handling
+    * clean-up some messages from rc_balance
+    * fix rc_startup_routine start delay
+    * fix rc_filter_duplicate initialization check
+    * fix stdin control mode for rc_balance
+    * add PRU to startup routine checks and required kernel modules
  -- Jason Kridner <jkridner@beagleboard.org>  Thu, 18 Jun 2020 00:17:41 -0400
 
 
-- 
GitLab


From 27d29077e41318a515162828d08d8ed28c1f6afd Mon Sep 17 00:00:00 2001
From: Jason Kridner <jdk@ti.com>
Date: Thu, 18 Jun 2020 20:50:06 +0000
Subject: [PATCH 07/13] motor.c: fix error in if statement

---
 library/src/motor.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/library/src/motor.c b/library/src/motor.c
index b2585ab..d95202c 100644
--- a/library/src/motor.c
+++ b/library/src/motor.c
@@ -111,6 +111,7 @@ int rc_motor_init_freq(int pwm_frequency_hz)
 	else if(rc_model()==MODEL_BB_POCKET) {
 		dirB_chip[1]=MDIR2B_CHIP_POCKET;
 		dirB_pin[1]=MDIR2B_PIN_POCKET;
+	}
 	else{
 		dirB_chip[1] = MDIR2B_CHIP;
 		dirB_pin[1] = MDIR2B_PIN;
-- 
GitLab


From fdf40e951d09067ef8594abd2de56c0b1bc4665f Mon Sep 17 00:00:00 2001
From: Jason Kridner <jdk@ti.com>
Date: Thu, 18 Jun 2020 21:03:12 +0000
Subject: [PATCH 08/13] Remove install.sh

---
 install.sh | 68 ------------------------------------------------------
 1 file changed, 68 deletions(-)
 delete mode 100755 install.sh

diff --git a/install.sh b/install.sh
deleted file mode 100755
index d1fb660..0000000
--- a/install.sh
+++ /dev/null
@@ -1,68 +0,0 @@
-# basic install script to help when installing from source
-# please use the debian package unless you know what you are doing!
-
-
-echo ""
-echo "This install script is just to help install from source."
-echo "If you are running this on a BeagleBone we recommend running"
-echo "the version which comes packaged and preinstalled in the "
-echo "official BeagleBone images. Please visit this link for details:"
-echo ""
-echo "http://strawsondesign.com/docs/librobotcontrol/"
-echo ""
-echo "To continue, enter 1 to compile and install on BeagleBone"
-echo "enter 2 for other platforms (Raspberry Pi, x86, etc..)"
-echo ""
-
-
-
-read n
-case $n in
-	1)
-		mode=BB
-		echo "ready to install on BeagleBone, press enter to continue"
-		;;
-	2)
-		mode=OTHER
-		echo "ready to install generic library, press enter to continue"
-		;;
-
-	*)
-		echo "invalid option"
-		exit;;
-esac
-
-# wait for keypress
-read n
-
-
-case $mode in
-	BB)
-		# for BBB, compile and install everything
-		sudo debian/preinst
-		make
-		sudo make install
-		sudo ldconfig
-		sudo systemctl daemon-reload
-		sudo systemctl enable robotcontrol
-		sudo systemctl enable rc_battery_monitor
-		sudo configure_robotics_dt.sh
-		;;
-	OTHER)
-		# for other platforms just install libary and examples
-		make -C library --no-print-directory
-		make -C examples --no-print-directory
-		sudo make -C library -s install
-		sudo make -C examples -s install
-		sudo ldconfig
-		;;
-	*)
-		echo "invalid option"
-		exit;;
-esac
-
-echo "finished!"
-
-
-
-
-- 
GitLab


From 06bc691af6684cdbbfcd52fab28bafffe84a693f Mon Sep 17 00:00:00 2001
From: Jason Kridner <jdk@ti.com>
Date: Thu, 18 Jun 2020 21:07:46 +0000
Subject: [PATCH 09/13] debian: these triggers are automatically added

---
 debian/triggers | 1 -
 1 file changed, 1 deletion(-)

diff --git a/debian/triggers b/debian/triggers
index dd86603..e69de29 100644
--- a/debian/triggers
+++ b/debian/triggers
@@ -1 +0,0 @@
-activate-noawait ldconfig
-- 
GitLab


From 0d2480bc9b86303ff76d929f816463991492b34b Mon Sep 17 00:00:00 2001
From: Jason Kridner <jdk@ti.com>
Date: Thu, 18 Jun 2020 21:17:49 +0000
Subject: [PATCH 10/13] docs: point to latest flasher image

---
 docs/src/flashing.dox | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/docs/src/flashing.dox b/docs/src/flashing.dox
index ca49980..9dea1f7 100644
--- a/docs/src/flashing.dox
+++ b/docs/src/flashing.dox
@@ -10,11 +10,11 @@ We highly recommend flashing the internal memory as the eMMC will generally prov
 
 \section flashing_s1 Flashing the Built-In eMMC Storage (recommended)
 
-The [BeagleBoard.org latest-images page](http://beagleboard.org/latest-images) is currently up to date with the 2018-10-07 stable image, but does not provide a version which will flash the built-in emmc memory. Here are the flasher images we recommend using for BeagleBone Black and BeagleBone Blue along with checksums you can optionally use to check the download integrity:
+Here are the flasher images we recommend using for BeagleBone Black and BeagleBone Blue along with checksums you can optionally use to check the download integrity:
 
-[2018-10-07 BeagleBone Black Flasher Image](http://strawsondesign.com/docs/images/BBB-blank-debian-9.5-iot-armhf-2018-10-07-4gb.img.xz) ([checksum](http://strawsondesign.com/docs/images/BBB-blank-debian-9.5-iot-armhf-2018-10-07-4gb.img.xz.sha256sum))
+[2020-04-06 BeagleBone Flasher Image](https://debian.beagleboard.org/images/bone-eMMC-flasher-debian-10.3-iot-armhf-2020-04-06-4gb.img.xz) ([checksum](https://debian.beagleboard.org/images/bone-eMMC-flasher-debian-10.3-iot-armhf-2020-04-06-4gb.img.xz.sha256sum))
 
-[2018-10-07 BeagleBone Blue Flasher Image](http://strawsondesign.com/docs/images/BBBL-blank-debian-9.5-iot-armhf-2018-10-07-4gb.img.xz) ([checksum](http://strawsondesign.com/docs/images/BBBL-blank-debian-9.5-iot-armhf-2018-10-07-4gb.img.xz.sha256sum))
+For BeagleBone Black + Robotics Cape, you'll still need to manually install the device tree overlay as the cape was designed without an identification EEPROM.
 
 These links are .xz compressed archives (like a .zip file). You must un-archive (extract) them before writing to a microSD card. The extracted .img file should be about 4GB in size. Do not just write the .xz archive to an SD card, it will not work.
 
@@ -54,4 +54,4 @@ After flashing a BeagleBone Black or Black Wireless with a clean image it is nec
 
 
 \tableofcontents
-*/
\ No newline at end of file
+*/
-- 
GitLab


From a50e071a7661eedebb9651b6936aec21cbd0e45a Mon Sep 17 00:00:00 2001
From: Jason Kridner <jdk@ti.com>
Date: Thu, 18 Jun 2020 21:37:37 +0000
Subject: [PATCH 11/13] debian: fix version dependency

---
 debian/control | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/debian/control b/debian/control
index d7ac3e8..119e7f2 100644
--- a/debian/control
+++ b/debian/control
@@ -8,7 +8,7 @@ Homepage: http://beagleboard.org/librobotcontrol
 
 Package: librobotcontrol
 Architecture: any
-Depends: debconf, bb-customizations (>= 1.20200522.1-0), ${shlibs:Depends}, ${misc:Depends}
+Depends: debconf, bb-customizations (>= 1.20200522), ${shlibs:Depends}, ${misc:Depends}
 Replaces: roboticscape
 Conflicts: roboticscape
 Provides: roboticscape
-- 
GitLab


From 23773c8c750b1a1ae7dbe62613c0c277cef4d937 Mon Sep 17 00:00:00 2001
From: Jason Kridner <jdk@ti.com>
Date: Thu, 18 Jun 2020 21:49:28 +0000
Subject: [PATCH 12/13] debian: drop config prompts to medium priority

---
 debian/config | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/debian/config b/debian/config
index abfe2de..8d15416 100644
--- a/debian/config
+++ b/debian/config
@@ -33,7 +33,7 @@ if [ ! "$DEBIAN_FRONTEND" = "noninteractive" ]; then
 
 	# first, for Black and Black wireless we need to ask to modify uEnv.txt
 	if [ "$ISBLACK" = "true" ]; then
-		db_input critical librobotcontrol/q_enable_dt || true
+		db_input medium librobotcontrol/q_enable_dt || true
 		db_go || true
 	fi
 
@@ -44,7 +44,7 @@ if [ ! "$DEBIAN_FRONTEND" = "noninteractive" ]; then
 	if [ "$RET" = "true" ]; then ISCAPE=true; fi
 
 	# ask for what should run on boot
-	db_input critical librobotcontrol/q_runonboot || true
+	db_input medium librobotcontrol/q_runonboot || true
 	db_go || true
 
 fi
-- 
GitLab


From 6d03fe3ce407e76a9da9111766ffa3fbbe9c1e47 Mon Sep 17 00:00:00 2001
From: "Mark A. Yoder" <Mark.A.Yoder@Rose-Hulman.edu>
Date: Fri, 19 Jun 2020 11:32:27 -0400
Subject: [PATCH 13/13] Fixed off by one for motor==0

---
 library/src/motor.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/library/src/motor.c b/library/src/motor.c
index d95202c..b41d7ba 100644
--- a/library/src/motor.c
+++ b/library/src/motor.c
@@ -254,7 +254,7 @@ int rc_motor_set(int motor, double duty)
 	else if	(duty <-1.0)	duty =-1.0;
 
 	if(motor==0){
-		for(i=1;i<channels;i++){
+		for(i=1;i<=channels;i++){
 			if(rc_motor_set(i,duty)==-1) return -1;
 		}
 		return 0;
@@ -298,7 +298,7 @@ int rc_motor_free_spin(int motor)
 
 	// case for all channels
 	if(motor==0){
-		for(i=1;i<channels;i++){
+		for(i=1;i<=channels;i++){
 			if(rc_motor_free_spin(i)==-1) return -1;
 		}
 		return 0;
@@ -337,7 +337,7 @@ int rc_motor_brake(int motor)
 
 	// case for all channels
 	if(motor==0){
-		for(i=1;i<channels;i++){
+		for(i=1;i<=channels;i++){
 			if(rc_motor_brake(i)==-1) return -1;
 		}
 		return 0;
-- 
GitLab