Skip to content

Commit

Permalink
add a few more explanitory comments
Browse files Browse the repository at this point in the history
  • Loading branch information
noahm committed Apr 16, 2024
1 parent b71f33d commit 1fd53c9
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion sdk/commands/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,11 @@ const OLD_CONFIG_INIT = [
export class SMXConfig {
public config: Decoded<typeof smx_config_t>;
private oldConfig: Decoded<typeof smx_old_config_t> | null = null;
/**
* some much older pads send smaller sized config data, so we need
* to keep track of how much they sent us and send back an appropriate
* sized config in the other direction
*/
private oldConfigSize: number | null = null;
private firmwareVersion: number;

Expand All @@ -362,7 +367,9 @@ export class SMXConfig {
console.log("Reading Old Config");

const slicedData = data.slice(2, -1);
const paddedData = padData(slicedData, 250);
// handle very old stage's smaller config data by padding
// it out to the full size of the `smx_old_config_t` struct
const paddedData = padData(slicedData, smx_old_config_t.byteLength);
this.oldConfig = smx_old_config_t.decode(paddedData, true);
this.config = this.convertOldToNew(this.oldConfig);
}
Expand Down

0 comments on commit 1fd53c9

Please sign in to comment.