Skip to content

Update sensor file options in vtxmenu.ini#99

Open
MarioFPVdev wants to merge 1 commit intoOpenIPC:mainfrom
MarioFPVdev:patch-22
Open

Update sensor file options in vtxmenu.ini#99
MarioFPVdev wants to merge 1 commit intoOpenIPC:mainfrom
MarioFPVdev:patch-22

Conversation

@MarioFPVdev
Copy link
Member

No description provided.

@tipoman9
Copy link
Collaborator

vtxmeni.ini file should be supported per firmware version, since sensor config files are different for different boards.
You can try this script that will enumerate all sensor config bin files in /etc/sensors and fill them in the vtx menu option automatically.
So it will always contain all the files included in the firmware, even when the user manually uploads new sensor.bin files.


# TipoMan
# Enumerate sensor config files and update them in /etc/vtxmenu.ini
INI="/etc/vtxmenu.ini"
SENSORDIR="/etc/sensors"

# Build comma-separated file list
FileList="$(find "$SENSORDIR" -type f -print | paste -sd ',' -)"

# Replacement line:
NEWLINE="Option3=SENSOR FILE:${FileList}:cli -g .isp.sensorConfig | tr a-z A-Z:cli -s .isp.sensorConfig \$(echo {} | tr A-Z a-z)"

# Backup the INI file
cp "$INI" "${INI}.bak" 2>/dev/null
echo "Backup completed."

# Process the file to only modify the Option3 line inside the [ISP] section
sed -n '
  # Start reading when we find [ISP]
  /^\[ISP\]/ { 
    print; 
    in_isp_section=1; 
    next 
  }
  
  # Once inside the [ISP] section, replace Option3
  in_isp_section && /^Option3=/ { 
    print "'"$NEWLINE"'"; 
    next 
  }
  
  # End of the [ISP] section, stop modifying
  in_isp_section && /^\[.*\]/ { 
    in_isp_section=0; 
  }
  
  # Print all other lines unchanged
  { print }
' "$INI" > "${INI}.tmp" && mv "${INI}.tmp" "$INI"

echo "Updated $INI"
echo "New Option3 value:"
echo "$NEWLINE"


@MarioFPVdev
Copy link
Member Author

In any case the vtxmenu as it is now is deprecated and will break majestic. That’s why probably most people are using the gsmenu. Feel free to update it with your proposal.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants