diff --git a/.vscode/.server-controller-port.log b/.vscode/.server-controller-port.log index d549be0..6104126 100644 --- a/.vscode/.server-controller-port.log +++ b/.vscode/.server-controller-port.log @@ -1,5 +1,5 @@ { "port": 13452, - "time": 1742632427298, + "time": 1742639833627, "version": "0.0.3" } \ No newline at end of file diff --git a/src/ascii_cmd.c b/src/ascii_cmd.c index 716c794..d8a9b8b 100644 --- a/src/ascii_cmd.c +++ b/src/ascii_cmd.c @@ -459,6 +459,89 @@ static void handle_eontp(char *arg, char *pattern, RDSModulator* mod, char* outp strcpy(output, "+\0"); } +static void handle_psn(char *arg, char *pattern, RDSModulator* mod, char* output) { + mod->enc->data[atoi(pattern)-1].psn = atoi(arg); + strcpy(output, "+\0"); +} + +static void handle_dsn(char *arg, char *pattern, RDSModulator* mod, char* output) { + mod->enc->data[atoi(pattern)-1].dsn = atoi(arg); + strcpy(output, "+\0"); +} + +static void handle_eonaf(char *arg, char *pattern, RDSModulator* mod, char* output) { + if (arg[0] == '\0') { + memset(&(mod->enc->data[mod->enc->program].eon[atoi(pattern)-1].af), 0, sizeof(mod->enc->data[mod->enc->program].eon[atoi(pattern)-1].af)); + strcpy(output, "+\0"); + return; + } + + memset(&(mod->enc->data[mod->enc->program].eon[atoi(pattern)-1].af), 0, sizeof(mod->enc->data[mod->enc->program].eon[atoi(pattern)-1].af)); + uint8_t arg_count; + RDSAFs new_af; + float af[MAX_AFS], *af_iter; + + arg_count = sscanf((char *)arg, + "%f,%f,%f,%f,%f," + "%f,%f,%f,%f,%f," + "%f,%f,%f,%f,%f," + "%f,%f,%f,%f,%f," + "%f,%f,%f,%f,%f", + &af[0], &af[1], &af[2], &af[3], &af[4], + &af[5], &af[6], &af[7], &af[8], &af[9], + &af[10], &af[11], &af[12], &af[13], &af[14], + &af[15], &af[16], &af[17], &af[18], &af[19], + &af[20], &af[21], &af[22], &af[23], &af[24]); + + af_iter = af; + memset(&new_af, 0, sizeof(RDSAFs)); + + while (arg_count-- != 0) { + add_rds_af(&new_af, *af_iter++); + } + + memcpy(&(mod->enc->data[mod->enc->program].eon[atoi(pattern)-1].af), &new_af, sizeof(mod->enc->data[mod->enc->program].eon[atoi(pattern)-1].af)); + strcpy(output, "+\0"); +} + +static void handle_eonafch(char *arg, char *pattern, RDSModulator* mod, char* output) { + if (arg[0] == '\0') { + memset(&(mod->enc->data[mod->enc->program].eon[atoi(pattern)-1].af), 0, sizeof(mod->enc->data[mod->enc->program].eon[atoi(pattern)-1].af)); + strcpy(output, "+\0"); + return; + } + + memset(&(mod->enc->data[mod->enc->program].eon[atoi(pattern)-1].af), 0, sizeof(mod->enc->data[mod->enc->program].eon[atoi(pattern)-1].af)); + uint8_t arg_count; + RDSAFs new_af; + uint8_t af[MAX_AFS], *af_iter; + + arg_count = sscanf((char *)arg, + "%hhx,%hhx,%hhx,%hhx,%hhx," + "%hhx,%hhx,%hhx,%hhx,%hhx," + "%hhx,%hhx,%hhx,%hhx,%hhx," + "%hhx,%hhx,%hhx,%hhx,%hhx," + "%hhx,%hhx,%hhx,%hhx,%hhx", + &af[0], &af[1], &af[2], &af[3], &af[4], + &af[5], &af[6], &af[7], &af[8], &af[9], + &af[10], &af[11], &af[12], &af[13], &af[14], + &af[15], &af[16], &af[17], &af[18], &af[19], + &af[20], &af[21], &af[22], &af[23], &af[24]); + + af_iter = af; + memset(&new_af, 0, sizeof(RDSAFs)); + + while (arg_count-- != 0) { + uint8_t current_value = *af_iter; + float frequency = (875.0 + current_value) / 10.0; + add_rds_af(&new_af, frequency); + af_iter++; + } + + memcpy(&(mod->enc->data[mod->enc->program].eon[atoi(pattern)-1].af), &new_af, sizeof(mod->enc->data[mod->enc->program].eon[atoi(pattern)-1].af)); + strcpy(output, "+\0"); +} + static const command_handler_t commands_eq3[] = { {"MS", handle_ms, 2}, {"PS", handle_ps, 2}, @@ -538,6 +621,10 @@ static const pattern_command_handler_t pattern_commands[] = { {"EON", "PTY", handle_eonpty}, {"EON", "TA", handle_eonta}, {"EON", "TP", handle_eontp}, + {"EON", "AF", handle_eonaf}, + {"EON", "AFCH", handle_eonafch}, + {"PSN", "", handle_psn}, + {"DSN", "", handle_dsn}, }; static bool process_command_table(const command_handler_t *table, int table_size, diff --git a/supported_cmds.txt b/supported_cmds.txt index aae35da..dfaabad 100644 --- a/supported_cmds.txt +++ b/supported_cmds.txt @@ -35,7 +35,7 @@ TPS INIT ALL - HELP -- EON* +EON* - MSG* - DPS2MSG - RT2MSG @@ -57,10 +57,10 @@ RDSGEN (SPEED) - STATUS, ?? (TIME) -- VER +VER - ADR *ADR - CC -- DSN* +DSN* ECCEN G GRPSEQ @@ -69,7 +69,7 @@ LIC PIN PINEN PROGRAM -- PSN* +PSN* (PSW) RTP RTPRUN @@ -78,91 +78,4 @@ SHORTRT - SITE *SITE UDG1 UDG2 -- UECP - -Magic RDS 4 Pages for PIRA32: -- Device Setup: - - Communication: - - Port Speed (will not be added) - - UECP (TODO:): - - General Enable - - Address List - - Site List - - Analog Control: - - RDS Output - - Subcarrier: - - Refrence (will not be added) - - Phase (will not be added) - - Date and Time (will not be added) - - Special: - - Reset (will not be added) - - Store ALL - - Initialize - - No Header off (TODO: find out what this means) - - Text messages: TODO: - - Internal Scheduler TODO: -- RDS Content: - - Program: - - PS - - PI - - TP - - MS - - PTY - - PTYN - - Radiotext: - - RT1: - - Text - - Default RT (save to memory) - - Default RT Timeout (TODO: DTTMOUT) - - RT2 (TODO:): - - Text - - Source (TODO: RT2MSG) - - Setup: - - RT1 Enabled - - RT2 Enabled (TODO:) - - Radiotext Type Bit (TODO: RTTYPE) - - Dynamic PS: - - DPS1 Text - - DPS1 Setup: - - DPS1 Enabled (Default: 0) - - DPS1 Mode (Default: 1) (TODO: 2 and 3) - - DPS1 Number of repeats (Default: 0, options: CLEAR) (TODO:) - - DPS2 (TODO:): - - DPS2 Text - - DPS2 Source (Default: 0, manual) - - DPS Setup (TODO:): - - DPS2 Enabled (Default: 0) - - DPS2 Mode (Default: 2) - - DPS2 Number of repeats (Default: 0) - - Common settings: - - Static PS period (Default: 16) - - DPS String Period (LABPER, Default: 0) - - Scrolling Speed (modes 0-3 Default: low) - - Restart DPS on change (options: Only if it's running, Always | first is Default) (TODO:) - - Alternative Frequency: - - AF Method (TODO: AF=A, AF=B) - ; A: - (list of freqs from 87,6 to 107,9) - Sets mode via `AF=A` and sets the af via AFCH - ; B: - entry for tuned freq - same programme AF - regional variant AF - Sets the AF to A then sets AFCH to tf and pairs, sends these? `*AF=1` `AFCH=` `*AF=2` `AF=B` (no clue) - - EON (TODO:): - - Other Network X: - - Enabled - - PI - - PS - - TP - - PTY - - AF Freqs (Mode A only) - - System: - - Group sequence - - Misc: - - DI - - ECC, LIC - - CT - - RT1=DPS1 (TODO: EQTEXT1) - - TPS - - TA Timeout (will not be added), TA external control (will not be added) \ No newline at end of file +- UECP \ No newline at end of file