Next-Flip / Momentum-Firmware

🐬 Feature-rich, stable and customizable Flipper Firmware
https://momentum-fw.dev
GNU General Public License v3.0
4.99k stars 206 forks source link

Infrared: Remove duplicates from Projectors universal remote #167

Closed Wemmy0 closed 4 months ago

Wemmy0 commented 4 months ago

What's new

Removed more duplicates from the Projectors.ir universal remote


For the reviewer

Wemmy0 commented 4 months ago

Only duplicates removed, nothing missing

Comparing files with python script: original projectors.ir | new projectors.ir

Original: 197
New: 196
Only empty line missing

Process finished with exit code 0

Script used:

def parse_ir_file(path):
    with open(path, "r") as file:
        data = file.readlines()

    new = list(data)
    for line in data:
        if "name: " in line:
            break
        else:
            new.remove(line)
    return new

def process(ir):
    data = parse_ir_file(ir)
    codes = []
    temp = ()
    for line in data:
        if "#" in line:
            codes.append(temp)
            temp = ()
        else:
            temp += (line,)
    return list(set(codes))

old = process("original projectors.ir")
new = process("new projectors.ir")
print(f"Original: {len(old)}")
print(f"New: {len(new)}")
for i in old:
    if i not in new:
        if i:
            print("#### MISSING ####")
            for l in i:
                print(l, end='')
        else:
            print("Only empty line missing")
Wemmy0 commented 4 months ago

Uploaded firmware to flipper and projectors.ir all works as expected but significantly faster. Power command gone from taking 48s -> 22s (122 -> 65 codes) IMG_7012 IMG_7015

Willy-JL commented 4 months ago

@Wemmy0 unleashed developer @xMasterX saw this and told me that duplicated signals are intentional: most projectors require 2 button presses to confirm shutdown. I reverted this PR, and only kept the new codes you had added, of which one is doubled for the same reason

Wemmy0 commented 4 months ago

Ah that makes a lot of sense and explains why there where so many