mirror of
https://github.com/pascallanger/DIY-Multiprotocol-TX-Module.git
synced 2025-02-04 22:38:14 +00:00
AVR modules: Fix KF606, GD00X and Potensic
This commit is contained in:
parent
7e6ec1dc8d
commit
18af4a0724
@ -61,13 +61,30 @@ uint8_t convert_channel_8b_limit_deadband(uint8_t num,uint8_t min,uint8_t mid, u
|
|||||||
{
|
{
|
||||||
uint16_t val=limit_channel_100(num); // 204<->1844
|
uint16_t val=limit_channel_100(num); // 204<->1844
|
||||||
uint16_t db_low=CHANNEL_MID-deadband, db_high=CHANNEL_MID+deadband; // 1024+-deadband
|
uint16_t db_low=CHANNEL_MID-deadband, db_high=CHANNEL_MID+deadband; // 1024+-deadband
|
||||||
|
int32_t calc;
|
||||||
|
uint8_t out;
|
||||||
if(val>=db_low && val<=db_high)
|
if(val>=db_low && val<=db_high)
|
||||||
return mid;
|
return mid;
|
||||||
else if(val<db_low)
|
else if(val<db_low)
|
||||||
val=min+(val-CHANNEL_MIN_100)*(mid-min)/(db_low-CHANNEL_MIN_100);
|
{
|
||||||
|
val-=CHANNEL_MIN_100;
|
||||||
|
calc=mid-min;
|
||||||
|
calc*=val;
|
||||||
|
calc/=(db_low-CHANNEL_MIN_100);
|
||||||
|
out=calc;
|
||||||
|
out+=min;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
val=mid+(val-db_high)*(max-mid)/(CHANNEL_MAX_100-1-db_high);
|
{
|
||||||
return val;
|
val-=db_high;
|
||||||
|
calc=max-mid;
|
||||||
|
calc*=val;
|
||||||
|
calc/=(CHANNEL_MAX_100-db_high+1);
|
||||||
|
out=calc;
|
||||||
|
out+=mid;
|
||||||
|
if(max>min) out++; else out--;
|
||||||
|
}
|
||||||
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reverse a channel and store it
|
// Reverse a channel and store it
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
#define VERSION_MAJOR 1
|
#define VERSION_MAJOR 1
|
||||||
#define VERSION_MINOR 2
|
#define VERSION_MINOR 2
|
||||||
#define VERSION_REVISION 1
|
#define VERSION_REVISION 1
|
||||||
#define VERSION_PATCH_LEVEL 82
|
#define VERSION_PATCH_LEVEL 83
|
||||||
|
|
||||||
//******************
|
//******************
|
||||||
// Protocols
|
// Protocols
|
||||||
|
Loading…
x
Reference in New Issue
Block a user