Skip to content

writing PDO2 voltage #6

@paulvha

Description

@paulvha

Looking at the code for "write" the value of PDO2 voltage in NVRAM is done with:

    // PDO2
   sector[4][1] = voltage[1] / 0.2; //load Voltage (sector 4, byte 1, bits 0:7)

Looks to me this is not using the correct way to save it. why not apply the same approach for PDO3 (but then on a different place in the sectors)

    // PDO2 
    // Load voltage (10-bit)
    // -bit 9:2 - sector 4, byte 1, bits 0:7
    // -bit 1:0 - sector 4, byte 0, bits 7:6
    digitalVoltage = voltage[1] / 0.05;   //convert voltage to 10-bit value
    sector[4][0] &= 0x3C;                 //clear bits 7:6
    sector[4][0] |= (digitalVoltage<<8);  //load bits 1:0
    sector[4][1] = 0xFF & (digitalVoltage >> 2); //load bits 9:2

regards,
Paul

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions