threeme3 / usdx

Simple and experimental (class-E driven) SSB transceiver.
616 stars 221 forks source link

Continues ATT support #33

Closed howard0su closed 3 years ago

howard0su commented 3 years ago

Combine the hardware and software ATT support into one single value to be continues from 0 to -85db.

The hardware ATT is prefered and used first. The following tables shows the caculation. The software ATT is changed to add three values that are shift by certain bits. So that we can simulate 1-15 db ATT via software.

s0  s1  s2  r       db
1   2   2   1        0.00
1   2   3   0.875   -1.16
1   2   5   0.78125 -2.14
1   3   4   0.6875  -3.25
2   2   3   0.625   -4.08
2   2   4   0.5625  -5.00
3   3   2   0.5     -6.02
2   3   4   0.4375  -7.18
2   3   6   0.3906  -8.16
2   4   5   0.34375 -9.28
3   4   3   0.3125  -10.10
3   3   5   0.28125 -11.02
3   4   4   0.25    -12.04

0 - 12 => software 13 - 19 => -13 hardware + software 20 - 32 => -20 hardware + software 33 - 39 => -20 + -13 hardware + software 40 - 52 => -40 hardware + software 53 - 59 => -40 + -13 hardware + software 60 - 72 => -40 + -20 hardware + software 73 - 85 => -40 + -20 + -13 hardware + software -12

Before: Sketch uses 27106 bytes (88%) of program storage space. Maximum is 30720 bytes. Global variables use 1291 bytes (63%) of dynamic memory, leaving 757 bytes for local variables. Maximum is 2048 bytes.

After: Sketch uses 27316 bytes (88%) of program storage space. Maximum is 30720 bytes. Global variables use 1235 bytes (60%) of dynamic memory, leaving 813 bytes for local variables. Maximum is 2048 bytes.

howard0su commented 3 years ago

@threeme3 I am not quite sure if this is worth.