alan broad
/
carbon_v5_arm_studio
arm studio build
Diff: src/wbit_util.cpp
- Revision:
- 7:fba1e8fc7693
- Parent:
- 5:abfe25f0de33
- Child:
- 8:a5316708e51d
diff -r b2039a285d7f -r fba1e8fc7693 src/wbit_util.cpp --- a/src/wbit_util.cpp Tue Aug 07 17:56:23 2018 +0000 +++ b/src/wbit_util.cpp Fri Aug 10 19:17:43 2018 +0000 @@ -43,15 +43,25 @@ //============================================================================== void printNmvData(nvm *pNvm){ uint8_t i; - if(verbose)pc.printf("\r\n************************************************************"); - if(verbose)pc.printf("\r\nnon-volatile memory (nvm):"); - if(verbose)pc.printf("\r\nnetwork_id:"); - - for (i = 0; i < 8;i++) - if(verbose)pc.printf(" %x",pNvm->network_id[i]); - if(verbose)pc.printf("\r\nnetwork_key:"); - for (i = 0 ; i < 16;i++) if(verbose)pc.printf(" %x",pNvm->network_key[i]); - if(verbose)pc.printf("\r\nbLogOutputOn: %d ",pNvm->bLogOutputOn); + if(verbose){ + pc.printf("\r\n************************************************************"); + pc.printf("\r\nnon-volatile memory (nvm):"); + pc.printf("\r\nnetwork_id:"); + for (i = 0; i < sizeof(network_id);i++) + pc.printf(" %x",pNvm->network_id[i]); + pc.printf("\r\nnetwork_key:"); + for (i = 0 ; i < sizeof(network_key);i++) + pc.printf(" %x",pNvm->network_key[i]); + pc.printf("\r\nbLogOutputOn: %d ",pNvm->bLogOutputOn); + + pc.printf("\r\n static backup keys:"); + pc.printf("\r\nnetwork_id:"); + for (i = 0; i < sizeof(network_id);i++) + pc.printf(" %x",network_id[i]); + pc.printf("\r\nnetwork_key:"); + for (i = 0 ; i < sizeof(network_key);i++) + pc.printf(" %x",network_key[i]); + } if(verbose)pc.printf("\r\n************************************************************\r\n"); } //============================================================================== @@ -85,13 +95,12 @@ uint8_t i; dot->nvmRead(0,pNvm,sizeof(nvm)); uint8_t chksum = getNvmChkSum(pNvm); -/* + if (chksum == pNvm->chksum){ - logInfo("nvmRead: chksum ok"); - //printNmvData(pNvm); + logInfo("nvmRead: chksum ok"); return true; } -*/ + //bad chksum, resort to old hard coded keys if(verbose)pc.printf("nvmRead: bad chksum, using default values"); for (i = 0; i < sizeof(network_id);i++){ @@ -100,7 +109,7 @@ for (i = 0; i < sizeof(network_key);i++){ pNvm->network_key[i] = network_key[i]; } - pNvm->bLogOutputOn = 1; //disable log output + pNvm->bLogOutputOn = 0; //disable log output // printNmvData(pNvm); return false; }