mirror of
https://github.com/radio95-rnt/rds95.git
synced 2026-02-26 20:33:53 +01:00
more stuff
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -55,3 +55,4 @@ build/
|
|||||||
*.pyc
|
*.pyc
|
||||||
__pycache__/
|
__pycache__/
|
||||||
.vscode/
|
.vscode/
|
||||||
|
.command_prefix.lua
|
||||||
@@ -20,7 +20,28 @@ install(TARGETS rds95 DESTINATION ${CMAKE_INSTALL_PREFIX}/bin)
|
|||||||
|
|
||||||
install(CODE
|
install(CODE
|
||||||
"
|
"
|
||||||
execute_process(COMMAND ${CMAKE_COMMAND} -E copy
|
# Define the paths for the source and destination files
|
||||||
\"${CMAKE_CURRENT_SOURCE_DIR}/src/command.lua\"
|
set(PREFIX_FILE \"${CMAKE_CURRENT_SOURCE_DIR}/.command_prefix.lua\")
|
||||||
\"$ENV{HOME}/.rds95.command.lua\")
|
set(COMMAND_FILE \"${CMAKE_CURRENT_SOURCE_DIR}/src/command.lua\")
|
||||||
")
|
# The $ENV{HOME} variable is evaluated at install time, not configure time
|
||||||
|
set(DEST_FILE \"$ENV{HOME}/.rds95.command.lua\")
|
||||||
|
|
||||||
|
# Check if the optional prefix file exists
|
||||||
|
if(EXISTS \${PREFIX_FILE})
|
||||||
|
# If it exists, read the prefix and the main command file
|
||||||
|
message(STATUS \"Prefix file found. Combining with command.lua.\")
|
||||||
|
file(READ \${PREFIX_FILE} PREFIX_CONTENT)
|
||||||
|
file(READ \${COMMAND_FILE} COMMAND_CONTENT)
|
||||||
|
# Concatenate them, with the prefix content first
|
||||||
|
set(FINAL_CONTENT \"\${PREFIX_CONTENT}\n\${COMMAND_CONTENT}\")
|
||||||
|
else()
|
||||||
|
# Otherwise, just use the content of the main command file
|
||||||
|
message(STATUS \"Prefix file not found. Using command.lua directly.\")
|
||||||
|
file(READ \${COMMAND_FILE} FINAL_CONTENT)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Write the resulting content to the destination file
|
||||||
|
message(STATUS \"Installing command file to \${DEST_FILE}\")
|
||||||
|
file(WRITE \${DEST_FILE} \"\${FINAL_CONTENT}\")
|
||||||
|
"
|
||||||
|
)
|
||||||
@@ -16,7 +16,7 @@ function set_rds_program_defaults() end
|
|||||||
---@return nil
|
---@return nil
|
||||||
function reset_rds() end
|
function reset_rds() end
|
||||||
|
|
||||||
---This function is called by the C core after the script is loaded.
|
---This function is called by the C core after we reset data, or have no data in general
|
||||||
---It should be defined by the user in the script.
|
---It should be defined by the user in the script.
|
||||||
---@return nil
|
---@return nil
|
||||||
function on_init() end
|
function on_init() end
|
||||||
|
|||||||
@@ -199,12 +199,6 @@ static void handle_ertprun(char *arg, RDSModulator* mod, char* output) {
|
|||||||
strcpy(output, "+");
|
strcpy(output, "+");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void handle_grpseq(char *arg, RDSModulator* mod, char* output) {
|
|
||||||
if (arg[0] == 0) set_rds_grpseq(mod->enc, DEFAULT_GRPSQC);
|
|
||||||
else set_rds_grpseq(mod->enc, arg);
|
|
||||||
strcpy(output, "+");
|
|
||||||
}
|
|
||||||
|
|
||||||
static void handle_eonen(char *arg, char *pattern, RDSModulator* mod, char* output) {
|
static void handle_eonen(char *arg, char *pattern, RDSModulator* mod, char* output) {
|
||||||
mod->enc->data[mod->enc->program].eon[atoi(pattern)-1].enabled = atoi(arg);
|
mod->enc->data[mod->enc->program].eon[atoi(pattern)-1].enabled = atoi(arg);
|
||||||
strcpy(output, "+");
|
strcpy(output, "+");
|
||||||
@@ -307,7 +301,6 @@ static const command_handler_t commands_eq2[] = {
|
|||||||
|
|
||||||
static const command_handler_t commands_eq7[] = {
|
static const command_handler_t commands_eq7[] = {
|
||||||
{"RTPRUN", handle_rtprun, 6},
|
{"RTPRUN", handle_rtprun, 6},
|
||||||
{"GRPSEQ", handle_grpseq, 6},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static const command_handler_t commands_eq8[] = {
|
static const command_handler_t commands_eq8[] = {
|
||||||
|
|||||||
@@ -10,6 +10,15 @@ if type(data) == "string" then
|
|||||||
elseif data == "reset" then
|
elseif data == "reset" then
|
||||||
reset_rds()
|
reset_rds()
|
||||||
return "+"
|
return "+"
|
||||||
|
elseif data == "pi" then return string.format("PI=%s\r\n", string.format("%x", get_rds_pi()))
|
||||||
|
elseif data == "pty" then return string.format("PTY=%s\r\n", string.format("%d", get_rds_pty()))
|
||||||
|
elseif data == "ecc" then return string.format("ECC=%s\r\n", string.format("%x", get_rds_ecc()))
|
||||||
|
elseif data == "slcd" then return string.format("SLCD=%s\r\n", string.format("%x", get_rds_slc_data()))
|
||||||
|
elseif data == "ct" then return string.format("CT=%s\r\n", string.format("%d", get_rds_ct()))
|
||||||
|
elseif data == "dpty" then return string.format("DPTY=%s\r\n", string.format("%d", get_rds_dpty()))
|
||||||
|
elseif data == "tp" then return string.format("TP=%s\r\n", string.format("%d", get_rds_tp()))
|
||||||
|
elseif data == "ta" then return string.format("TA=%s\r\n", string.format("%d", get_rds_ta()))
|
||||||
|
-- TODO: more
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
cmd = cmd:lower()
|
cmd = cmd:lower()
|
||||||
@@ -131,6 +140,12 @@ if type(data) == "string" then
|
|||||||
if not timeout then return "-" end
|
if not timeout then return "-" end
|
||||||
set_rds_rt_text_timeout(timeout)
|
set_rds_rt_text_timeout(timeout)
|
||||||
return "+"
|
return "+"
|
||||||
|
elseif cmd == "grpseq" then
|
||||||
|
set_rds_grpseq(value)
|
||||||
|
return "+"
|
||||||
|
elseif cmd == "grpseq2" then
|
||||||
|
set_rds_grpseq2(value)
|
||||||
|
return "+"
|
||||||
else
|
else
|
||||||
return "?"
|
return "?"
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user