Skip to content

Commit 228a722

Browse files
committed
V2.0.7
- removed MYSERIAL definition - removed all 'print' functionality
1 parent 33e8978 commit 228a722

9 files changed

Lines changed: 187 additions & 175 deletions

File tree

examples/HandDemo/HandDemo.ino

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,10 @@
2424
// number of controllable fingers (number of motors)
2525
#if defined(ALMOND_BOARD)
2626
#define NUM_FINGERS 5
27+
#define MYSERIAL Serial
2728
#elif defined(CHESTNUT_BOARD)
2829
#define NUM_FINGERS 4
30+
#define MYSERIAL SerialUSB
2931
#else
3032
#error 'No board selected'
3133
#endif

examples/MotorTest/MotorTest.ino

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,10 @@
2727
// number of controllable fingers (number of motors)
2828
#if defined(ALMOND_BOARD)
2929
#define NUM_FINGERS 5
30+
#define MYSERIAL Serial
3031
#elif defined(CHESTNUT_BOARD)
3132
#define NUM_FINGERS 4
33+
#define MYSERIAL SerialUSB
3234
#else
3335
#error 'No board selected'
3436
#endif

examples/MultipleFingers/MultipleFingers.ino

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,10 @@
2525
// number of controllable fingers (number of motors)
2626
#if defined(ALMOND_BOARD)
2727
#define NUM_FINGERS 5
28+
#define MYSERIAL Serial
2829
#elif defined(CHESTNUT_BOARD)
2930
#define NUM_FINGERS 4
31+
#define MYSERIAL SerialUSB
3032
#else
3133
#error 'No board selected'
3234
#endif

examples/SingleFinger/SingleFinger.ino

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,21 @@
1717
*
1818
*/
1919

20+
// uncomment one of the following to select the board
21+
//#define ALMOND_BOARD
22+
#define CHESTNUT_BOARD
23+
24+
// number of controllable fingers (number of motors)
25+
#if defined(ALMOND_BOARD)
26+
#define NUM_FINGERS 5
27+
#define MYSERIAL Serial
28+
#elif defined(CHESTNUT_BOARD)
29+
#define NUM_FINGERS 4
30+
#define MYSERIAL SerialUSB
31+
#else
32+
#error 'No board selected'
33+
#endif
34+
2035
// initialise Finger class to array, and assigns pins
2136
Finger finger;
2237

keywords.txt

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,13 @@ motorEnable KEYWORD2
5353
enableForceSense KEYWORD2
5454
disableForceSense KEYWORD2
5555

56-
printPos KEYWORD2
57-
printPosError KEYWORD2
58-
printDir KEYWORD2
59-
printReached KEYWORD2
60-
pritSpeed KEYWORD2
61-
printDetails KEYWORD2
62-
printConfig KEYWORD2
56+
# printPos KEYWORD2
57+
# printPosError KEYWORD2
58+
# printDir KEYWORD2
59+
# printReached KEYWORD2
60+
# pritSpeed KEYWORD2
61+
# printDetails KEYWORD2
62+
# printConfig KEYWORD2
6363

6464
#######################################
6565
# Constants (LITERAL1)

library.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name=FingerLib
2-
version=2.0.6
2+
version=2.0.7
33
author=Olly McBride
44
maintainer=Olly McBride <ollymcbride@openbionics.com>
55
sentence=Allows for servo-like functionality for finger control. For Atmega 2560 (Almond PCB) and Arduino Zero (Chestnut) only.

src/FingerLib.cpp

Lines changed: 135 additions & 143 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,6 @@ Finger::Finger()
2525
{
2626
if (fingerIndex >= MAX_FINGERS) // if too many fingers have been initialised
2727
{
28-
MYSERIAL.print("ERROR - Too many fingers attached (");
29-
MYSERIAL.print(fingerIndex);
30-
MYSERIAL.println(")");
31-
3228
fingerIndex = -1; // set current finger number to be empty
3329
_isActive = false; // set current finger as inactive
3430
}
@@ -133,7 +129,7 @@ uint8_t Finger::attach(uint8_t dir0, uint8_t dir1, uint8_t posSns, uint8_t force
133129
}
134130
else // if the current finger number isn't valid
135131
{
136-
MYSERIAL.println("ERROR - Too many fingers attached");
132+
//MYSERIAL.println("ERROR - Too many fingers attached");
137133
_isActive = false; // set the current finger to be inactive
138134
return (uint8_t)(-1); // return BLANK
139135
}
@@ -471,140 +467,140 @@ void Finger::disableForceSense(void)
471467

472468
// PRINT
473469

474-
// print the current position (no new line)
475-
void Finger::printPos(void)
476-
{
477-
printPos(0);
478-
}
479-
480-
// print the current position (new line)
481-
void Finger::printPos(bool newL)
482-
{
483-
MYSERIAL.print("Pos ");
484-
MYSERIAL.print(readPos());
485-
MYSERIAL.print(" ");
486-
if (newL)
487-
MYSERIAL.print("\n");
488-
}
489-
490-
// print the current position error (no new line)
491-
void Finger::printPosError(void)
492-
{
493-
printPosError(0);
494-
}
495-
496-
// print the current position error (new line)
497-
void Finger::printPosError(bool newL)
498-
{
499-
MYSERIAL.print("Err ");
500-
MYSERIAL.print(readPosError());
501-
MYSERIAL.print(" ");
502-
if (newL)
503-
MYSERIAL.print("\n");
504-
}
505-
506-
// print the current direction (no new line)
507-
void Finger::printDir(void)
508-
{
509-
printDir(0);
510-
}
511-
512-
// print the current direction (new line)
513-
void Finger::printDir(bool newL)
514-
{
515-
const char* _dirString[2] = { "OPEN","CLOSE" }; // direction string
516-
517-
MYSERIAL.print("Dir ");
518-
MYSERIAL.print(_dirString[readDir()]);
519-
MYSERIAL.print(" ");
520-
if (newL)
521-
MYSERIAL.print("\n");
522-
}
523-
524-
// print whether the target position has been reached (no new line)
525-
void Finger::printReached(void)
526-
{
527-
printReached(0);
528-
}
529-
530-
// print whether the target position has been reached (new line)
531-
void Finger::printReached(bool newL)
532-
{
533-
MYSERIAL.print("Reached ");
534-
MYSERIAL.print(reachedPos());
535-
MYSERIAL.print(" ");
536-
if (newL)
537-
MYSERIAL.print("\n");
538-
}
539-
540-
// print the current speed (no new line)
541-
void Finger::printSpeed(void)
542-
{
543-
printSpeed(0);
544-
}
545-
546-
// print the current speed (new line)
547-
void Finger::printSpeed(bool newL)
548-
{
549-
MYSERIAL.print("Speed ");
550-
MYSERIAL.print(readSpeed());
551-
MYSERIAL.print(" ");
552-
if (newL)
553-
MYSERIAL.print("\n");
554-
}
555-
556-
// print current position, direction, speed and whether the target position has been reached
557-
void Finger::printDetails(void)
558-
{
559-
MYSERIAL.print("Finger ");
560-
MYSERIAL.print(fingerIndex);
561-
MYSERIAL.print(" ");
562-
printPos();
563-
printDir();
564-
printSpeed();
565-
printReached(true); // print new line after
566-
567-
}
568-
569-
// print finger number, pins and limits
570-
void Finger::printConfig(void)
571-
{
572-
MYSERIAL.print("Finger");
573-
MYSERIAL.print(fingerIndex);
574-
MYSERIAL.print(" -");
575-
MYSERIAL.print(" \tdir0: ");
576-
MYSERIAL.print(_pin.dir[0]);
577-
MYSERIAL.print(" \tdir1: ");
578-
MYSERIAL.print(_pin.dir[1]);
579-
MYSERIAL.print(" \tposSense: ");
580-
MYSERIAL.print(_pin.posSns);
581-
#ifdef FORCE_SENSE
582-
MYSERIAL.print(" \tforceSense: ");
583-
MYSERIAL.print(_pin.forceSns);
584-
#endif
585-
MYSERIAL.print("\tinvert: ");
586-
MYSERIAL.println(_invert);
587-
588-
MYSERIAL.print("MinPos: ");
589-
MYSERIAL.print(_pos.limit.min);
590-
MYSERIAL.print("\tMaxPos: ");
591-
MYSERIAL.println(_pos.limit.max);
592-
593-
MYSERIAL.print("MinSpeed: ");
594-
MYSERIAL.print(_speed.limit.min);
595-
MYSERIAL.print("\tMaxSpeed: ");
596-
MYSERIAL.println(_speed.limit.max);
597-
598-
#ifdef FORCE_SENSE
599-
MYSERIAL.print("MinForce: ");
600-
MYSERIAL.print(_force.limit.min);
601-
MYSERIAL.print("\tMaxForce: ");
602-
MYSERIAL.println(_force.limit.max);
603-
#endif
604-
605-
606-
MYSERIAL.print("\n");
607-
}
470+
//// print the current position (no new line)
471+
//void Finger::printPos(void)
472+
//{
473+
// printPos(0);
474+
//}
475+
//
476+
//// print the current position (new line)
477+
//void Finger::printPos(bool newL)
478+
//{
479+
// MYSERIAL.print("Pos ");
480+
// MYSERIAL.print(readPos());
481+
// MYSERIAL.print(" ");
482+
// if (newL)
483+
// MYSERIAL.print("\n");
484+
//}
485+
//
486+
//// print the current position error (no new line)
487+
//void Finger::printPosError(void)
488+
//{
489+
// printPosError(0);
490+
//}
491+
//
492+
//// print the current position error (new line)
493+
//void Finger::printPosError(bool newL)
494+
//{
495+
// MYSERIAL.print("Err ");
496+
// MYSERIAL.print(readPosError());
497+
// MYSERIAL.print(" ");
498+
// if (newL)
499+
// MYSERIAL.print("\n");
500+
//}
501+
//
502+
//// print the current direction (no new line)
503+
//void Finger::printDir(void)
504+
//{
505+
// printDir(0);
506+
//}
507+
//
508+
//// print the current direction (new line)
509+
//void Finger::printDir(bool newL)
510+
//{
511+
// const char* _dirString[2] = { "OPEN","CLOSE" }; // direction string
512+
//
513+
// MYSERIAL.print("Dir ");
514+
// MYSERIAL.print(_dirString[readDir()]);
515+
// MYSERIAL.print(" ");
516+
// if (newL)
517+
// MYSERIAL.print("\n");
518+
//}
519+
//
520+
//// print whether the target position has been reached (no new line)
521+
//void Finger::printReached(void)
522+
//{
523+
// printReached(0);
524+
//}
525+
//
526+
//// print whether the target position has been reached (new line)
527+
//void Finger::printReached(bool newL)
528+
//{
529+
// MYSERIAL.print("Reached ");
530+
// MYSERIAL.print(reachedPos());
531+
// MYSERIAL.print(" ");
532+
// if (newL)
533+
// MYSERIAL.print("\n");
534+
//}
535+
//
536+
//// print the current speed (no new line)
537+
//void Finger::printSpeed(void)
538+
//{
539+
// printSpeed(0);
540+
//}
541+
//
542+
//// print the current speed (new line)
543+
//void Finger::printSpeed(bool newL)
544+
//{
545+
// MYSERIAL.print("Speed ");
546+
// MYSERIAL.print(readSpeed());
547+
// MYSERIAL.print(" ");
548+
// if (newL)
549+
// MYSERIAL.print("\n");
550+
//}
551+
//
552+
//// print current position, direction, speed and whether the target position has been reached
553+
//void Finger::printDetails(void)
554+
//{
555+
// MYSERIAL.print("Finger ");
556+
// MYSERIAL.print(fingerIndex);
557+
// MYSERIAL.print(" ");
558+
// printPos();
559+
// printDir();
560+
// printSpeed();
561+
// printReached(true); // print new line after
562+
//
563+
//}
564+
//
565+
//// print finger number, pins and limits
566+
//void Finger::printConfig(void)
567+
//{
568+
// MYSERIAL.print("Finger");
569+
// MYSERIAL.print(fingerIndex);
570+
// MYSERIAL.print(" -");
571+
// MYSERIAL.print(" \tdir0: ");
572+
// MYSERIAL.print(_pin.dir[0]);
573+
// MYSERIAL.print(" \tdir1: ");
574+
// MYSERIAL.print(_pin.dir[1]);
575+
// MYSERIAL.print(" \tposSense: ");
576+
// MYSERIAL.print(_pin.posSns);
577+
//#ifdef FORCE_SENSE
578+
// MYSERIAL.print(" \tforceSense: ");
579+
// MYSERIAL.print(_pin.forceSns);
580+
//#endif
581+
// MYSERIAL.print("\tinvert: ");
582+
// MYSERIAL.println(_invert);
583+
//
584+
// MYSERIAL.print("MinPos: ");
585+
// MYSERIAL.print(_pos.limit.min);
586+
// MYSERIAL.print("\tMaxPos: ");
587+
// MYSERIAL.println(_pos.limit.max);
588+
//
589+
// MYSERIAL.print("MinSpeed: ");
590+
// MYSERIAL.print(_speed.limit.min);
591+
// MYSERIAL.print("\tMaxSpeed: ");
592+
// MYSERIAL.println(_speed.limit.max);
593+
//
594+
//#ifdef FORCE_SENSE
595+
// MYSERIAL.print("MinForce: ");
596+
// MYSERIAL.print(_force.limit.min);
597+
// MYSERIAL.print("\tMaxForce: ");
598+
// MYSERIAL.println(_force.limit.max);
599+
//#endif
600+
//
601+
//
602+
// MYSERIAL.print("\n");
603+
//}
608604

609605

610606
//
@@ -789,10 +785,6 @@ void Finger::forceController(void)
789785
// if force limit is reached
790786
if (_force.curr > _force.limit.max)
791787
{
792-
MYSERIAL.print("F");
793-
MYSERIAL.print(fingerIndex);
794-
MYSERIAL.println(" max force");
795-
796788
// store current movement direction so that stopping the motor is not perceived as a direction change
797789
bool tempDir = _dir.curr;
798790

0 commit comments

Comments
 (0)