Pico Run-time Configuration
The Pico uses it’s flash storage to store some runtime configuration values.
Attributes
The Configuration System on the Pico uses a Protobuf message to serialize the configuration.
message ConfigProto {
/** Because this makes the message variable length we need options to say this is a callback message */
string rpiFwGitCommitHash = 1;
bool isIbusLogOutputEnabled = 2;
enum LoggingLevels {
Logging_NotSet = 0; DEBUG = 1; INFO = 2; WARN = 3; ERROR = 4; WTF = 5;
}
LoggingLevels enabledMaxLogLevelForIbusLog = 3;
LoggingLevels enabledMaxLogLevelForPrintfLog = 4;
//If enabled, always turn on the Pi4 power supply when we start up.
bool alwaysTurnOnRpiOnStatup = 5;
//If enabled, send a packet to turn on BMBT screen
bool alwaysTurnOnScreenOnIbusActivity = 6;
enum ScanProgram {
Scan_Program_NotSet = 0;
NONE = 1;
CLOCK = 2;
LINSTEROS_BOOTSPLASH = 3;
GOOSE_BOOTSPLASH = 4;
BMW_BOOTSPLASH = 5;
MENU = 6;
}
ScanProgram scanProgramOnBoot = 7;
enum VideoSource {
RVC = 0x0; UPSTREAM = 0x1; PICO = 0x2; PI = 0x3;
}
VideoSource videoSourceOnBoot = 8;
// https://github.com/piersholt/wilhelm-docs/blob/master/bmbt/4f.md
bool sendBMBTEncodingPacketOnBootup = 9;
enum VideoEncoding {
NTSC = 0; PAL = 1;
}
enum AspectRatio {
FourThree = 0; SixteenNine = 1; Zoom = 2;
}
VideoEncoding videoEncoding = 10;
AspectRatio aspectRatio = 11;
}
Logging
These attributes set how chatty the pico logs are:
bool isIbusLogOutputEnabled = 2;
enum LoggingLevels {
Logging_NotSet = 0; DEBUG = 1; INFO = 2; WARN = 3; ERROR = 4; WTF = 5;
}
LoggingLevels enabledMaxLogLevelForIbusLog = 3;
LoggingLevels enabledMaxLogLevelForPrintfLog = 4;
They can be turned down or off at run-time to preserve bandwidth on the Ibus between the pico and the pi.
Video Encoding
Some early BMBTs need a packet sent to set their video mode correctly. https://github.com/piersholt/wilhelm-docs/blob/master/bmbt/4f.md
I haven’t had a need to use this on my car or bench setups, but I put it in here in case someone does need it.
ScanProgram
This one is a bit of an easter egg
enum ScanProgram {
Scan_Program_NotSet = 0;
NONE = 1;
CLOCK = 2;
LINSTEROS_BOOTSPLASH = 3;
GOOSE_BOOTSPLASH = 4;
BMW_BOOTSPLASH = 5;
MENU = 6;
}
ScanProgram scanProgramOnBoot = 7;
The LinsterOS bootsplash is the one that works the best with the menu. However, setting this to GOOSE shows my scout group’s logo. Some of the bootsplashes aren’t finished.
Editing the Configuration
The configurated is edited with the PicoCommsDebug window, which then actuates the Configuration Request/Response Cycle shown below:
Configuration Request/Response
message PicoToPi {
enum MessageType {
...
//Dump the config object
ConfigStatusResponse = 4;
...
and
message PiToPico {
enum MessageType {
...
ConfigStatusRequest = 3; //Instruct the pico to tell us what it's config object is
ConfigPush = 4; //Tell the pico what it's new config object should be
First, the existing config is read with a ConfigStatusRequest
message sent from the PiToPico. The Pico responds with a ConfigStatusResponse
PicoToPi message. Then, the user edits the config with the PicoCommsDebug window. When the user wants to save it, they send a PiToPico ConfigPush
message, which the Pico then receives and saves the config to Flash memory.