whosmatt / uvmod

Web-based firmware patcher for various Quansheng radios
https://whosmatt.github.io/uvmod/
268 stars 47 forks source link

Added Mod_ToneBurst by@RE3CON #11

Closed RE3CON closed 1 year ago

RE3CON commented 1 year ago

added my code part // Mod_ToneBurst by RE3CON rewritten to java from python mod by IK8JHL mod_change_Tone_1750Hz.py !!!

class Mod_ToneBurst extends FirmwareMod { constructor() { super("Repeater Tone Burst (by RE3CON)", "Changes the Tone by PTT and Side F2 Key, used to open HAM Repeaters and NOAA Channels. The default is 1750 Hz. To open NOAA Ton-Squelch set 1050 Hz. Other not so common repeater tone pulse freq are 1000Hz, 1450Hz, 1750Hz, 2100Hz", 0); this.inputTone = addInputField(this.modSpecificDiv, "Enter a new Tone Burst frequency (Hz)", "1050"); }

    apply(firmwareData) {
        const offset = 0x29cc;

        const tone = (this.inputTone.value);

        if (tone <= 0xffff) {

            const buffer = new ArrayBuffer(8);
            const dataView = new DataView(buffer);

            dataView.setUint32(0, tone, true); 

            const toneHex = new Uint8Array(buffer);

            firmwareData = replaceSection(firmwareData, toneHex, offset);

            log(`Success: ${this.name} applied.`);
        }
        else {
            log(`ERROR in ${this.name}: Unexpected data, already patched or wrong firmware?`);
        }

        return firmwareData;
    }
}
,

// EOT -- Mod_Tone_ToneBurst by RE3CON