Skip to content

Commit

Permalink
Revert "abdrive360/servo360 - try EEPROM calibration / transfer funct…
Browse files Browse the repository at this point in the history
…ion adjusting functions #151"

This reverts commit cf415cb.
  • Loading branch information
AndyLindsay committed Oct 10, 2017
1 parent 1125a3f commit 40eafb5
Show file tree
Hide file tree
Showing 14 changed files with 24 additions and 2,309 deletions.
1 change: 0 additions & 1 deletion Learn/Simple Libraries/Motor/libservo360/libservo360.side
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ servo360_couple.c
servo360_setCoupleScale.c
servo360_setAngleOffset.c
servo360_getAngleOffset.c
servo360_setTransferFunction.c
>compiler=C
>memtype=cmm main ram compact
>optimize=-Os
Expand Down
21 changes: 9 additions & 12 deletions Learn/Simple Libraries/Motor/libservo360/servo360.c
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,10 @@ void servo360_mainLoop()
{
if(_fs[p].pinCtrl != -1 && _fs[p].pinFb != -1)
{
//if(_fs[p].feedback)
//{
if(_fs[p].feedback)
{
servo360_checkAngle(p);
//}
}
}
}

Expand Down Expand Up @@ -258,7 +258,7 @@ void servo360_outputSelector(int p)
if(_fs[p].csop == S360_POSITION)
{
int output = servo360_pidA(p);
_fs[p].pw = servo360_upsToPulseFromTransferFunction(output, p);
_fs[p].pw = servo360_upsToPulseFromTransferFunction(output);
_fs[p].speedOut = _fs[p].pw - 15000;
}
else if(_fs[p].csop == S360_SPEED)
Expand Down Expand Up @@ -552,20 +552,17 @@ int servo360_upsToPulseFromTransferFunction(int unitsPerSec)
}
*/

int servo360_upsToPulseFromTransferFunction(int unitsPerSec, int p)
int servo360_upsToPulseFromTransferFunction(int unitsPerSec)
{
int y, m, x, b;
x = unitsPerSec;
int y, x = unitsPerSec, m = S360_VM, b;

if(x > 0)
{
m = _fs[p].vmCcw;
b = _fs[p].vbCcw;
b = S360_VB_POS;
}
else if(x < 0)
{
m = _fs[p].vmCw;
b = _fs[p].vbCw;
b = S360_VB_NEG;
}
else
{
Expand Down Expand Up @@ -622,7 +619,7 @@ void servo360_speedControl(int p)
//speedUpdateFlag = 0;
}
}
_fs[p].pw = servo360_upsToPulseFromTransferFunction(_fs[p].speedTarget, p);
_fs[p].pw = servo360_upsToPulseFromTransferFunction(_fs[p].speedTarget);
_fs[p].drive = _fs[p].pw - 15000;
_fs[p].opPidV = _fs[p].drive + servo360_pidV(p);
}
Expand Down
27 changes: 5 additions & 22 deletions Learn/Simple Libraries/Motor/libservo360/servo360.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,13 @@




//#define _servo360_monitor_





#ifndef SERVO360_H
#define SERVO360_H

Expand All @@ -35,16 +37,9 @@ extern "C" {
#define S360_UNITS_FULL_CIRCLE 360
#define S360_MAX_SPEED 2 * 4096

#define S360_VB_POS 200
#define S360_VB_NEG -200
#define S360_VM 180
//#define S360_VB_POS 200
//#define S360_VB_NEG -200
#define S360_VM_CCW S360_VM
#define S360_VM_CW S360_VM

#define S360_VM_CCW S360_VM
#define S360_VM_CW S360_VM
#define S360_VB_CCW 200
#define S360_VB_CW -200

#define S360_DUTY_CYCLE_MIN 290
#define S360_DUTY_CYCLE_MAX 9710
Expand Down Expand Up @@ -108,10 +103,6 @@ extern "C" {
#define S360_SETTING_KIA 6
#define S360_SETTING_KDA 7
#define S360_SETTING_IA_MAX 8
#define S360_SETTING_VB_CCW 9
#define S360_SETTING_VB_CW 10
#define S360_SETTING_VM_CCW 11
#define S360_SETTING_VM_CW 12

//#define S360_A_MAX (((1 << 31) - 1)) / S360_UNITS_FULL_CIRCLE // 524287 degrees
#define S360_A_MAX 524287
Expand Down Expand Up @@ -197,7 +188,7 @@ void servo360_setPositiveDirection(int p, int direction);

int servo360_setRampStep(int p, int stepSize);

int servo360_upsToPulseFromTransferFunction(int unitsPerSec, int p);
int servo360_upsToPulseFromTransferFunction(int unitsPerSec);
void servo360_pulseControl(int p, int speedUps);

void servo360_speedControl(int p);
Expand All @@ -215,9 +206,6 @@ int servo360_setMaxSpeedEncoded(int pin, int speed);
void servo360_monitorRun(void);
void servo360_monitorEnd(void);

int servo360_setTransferFunction(int pin, int constant, int value);


/*
__attribute__((constructor))
void servo360_patch(void);
Expand Down Expand Up @@ -267,11 +255,6 @@ typedef volatile struct servo360_s
volatile int coupleScale;
volatile int enable;

volatile int vmCcw;
volatile int vmCw;
volatile int vbCcw;
volatile int vbCw;

// admin
volatile int csop;
volatile int speedReq;
Expand Down
5 changes: 0 additions & 5 deletions Learn/Simple Libraries/Motor/libservo360/servo360_connect.c
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,6 @@ int servo360_connect(int pinControl, int pinFeedback)
_fs[p].enable = 1;

_fb360c.devCount++;

_fs[p].vmCcw = S360_VM_CCW;
_fs[p].vmCw = S360_VM_CW;
_fs[p].vbCcw = S360_VB_CCW;
_fs[p].vbCw = S360_VB_CW;

lockclr(_fb360c.lock360);

Expand Down

This file was deleted.

Loading

0 comments on commit 40eafb5

Please sign in to comment.