aw_cir: lower activation threshold to support NECx protocol
In NECx the leading mark has length of 8T as opposed to 16T in NEC, where T is 562.5 us. So, 4.5 ms. Our threshold was set to 128 * 42.7 us (derived from the sampling frequency of 3/128 MHz). So, ~5.5 ms. The new threshold is set to AW_IR_L1_MIN. I think that's a good enough lower bound for detecting the leading pulse. Also, calculations of active_delay (which is activation delay) are fixed. Previously they would be wrong if AW_IR_ACTIVE_T was anything but zero, because the value was already bit-shifted. Finally, I am not sure why the activation delay was divided by two when calculating the initial pulse length. I have not found anything that would explain or justify it. So, I removed that division. MFC after: 3 weeks
This commit is contained in:
parent
8b616b263d
commit
852d135791
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=364148
@ -126,8 +126,10 @@ __FBSDID("$FreeBSD$");
|
|||||||
#define AW_IR_DMAX 53
|
#define AW_IR_DMAX 53
|
||||||
|
|
||||||
/* Active Thresholds */
|
/* Active Thresholds */
|
||||||
#define AW_IR_ACTIVE_T ((0 & 0xff) << 16)
|
#define AW_IR_ACTIVE_T_VAL AW_IR_L1_MIN
|
||||||
#define AW_IR_ACTIVE_T_C ((1 & 0xff) << 23)
|
#define AW_IR_ACTIVE_T (((AW_IR_ACTIVE_T_VAL - 1) & 0xff) << 16)
|
||||||
|
#define AW_IR_ACTIVE_T_C_VAL 0
|
||||||
|
#define AW_IR_ACTIVE_T_C ((AW_IR_ACTIVE_T_C_VAL & 0xff) << 23)
|
||||||
|
|
||||||
/* Code masks */
|
/* Code masks */
|
||||||
#define CODE_MASK 0x00ff00ff
|
#define CODE_MASK 0x00ff00ff
|
||||||
@ -209,9 +211,9 @@ aw_ir_decode_packets(struct aw_ir_softc *sc)
|
|||||||
device_printf(sc->dev, "sc->dcnt = %d\n", sc->dcnt);
|
device_printf(sc->dev, "sc->dcnt = %d\n", sc->dcnt);
|
||||||
|
|
||||||
/* Find Lead 1 (bit separator) */
|
/* Find Lead 1 (bit separator) */
|
||||||
active_delay = (AW_IR_ACTIVE_T + 1) * (AW_IR_ACTIVE_T_C != 0 ? 128 : 1);
|
active_delay = AW_IR_ACTIVE_T_VAL *
|
||||||
len = 0;
|
(AW_IR_ACTIVE_T_C_VAL != 0 ? 128 : 1);
|
||||||
len += (active_delay >> 1);
|
len = active_delay;
|
||||||
if (bootverbose)
|
if (bootverbose)
|
||||||
device_printf(sc->dev, "Initial len: %ld\n", len);
|
device_printf(sc->dev, "Initial len: %ld\n", len);
|
||||||
for (i = 0; i < sc->dcnt; i++) {
|
for (i = 0; i < sc->dcnt; i++) {
|
||||||
|
Loading…
Reference in New Issue
Block a user