small change

This commit is contained in:
carina@hades 2022-10-14 12:23:16 -04:00
parent 9f7182673e
commit 821c73362b
2 changed files with 20 additions and 21 deletions

View File

@ -380,6 +380,8 @@ void Digitizer::ReadData(){
}
//===========================================================
//===========================================================
//===========================================================
void Digitizer::WriteRegister(Reg registerAddress, uint32_t value, int ch, bool isSave2MemAndFile){
if( !isConnected ) return;
@ -458,10 +460,6 @@ void Digitizer::ReadAllSettingsFromBoard(){
isSettingFilledinMemeory = true;
}
void Digitizer::SetSettingFromMemory(Reg registerAddress, int ch){
WriteRegister(registerAddress, GetSettingFromMemory(registerAddress, ch), ch, false);
}
void Digitizer::ProgramSettingsToBoard(){
if( !isConnected ) return;
/// board setting
@ -590,36 +588,38 @@ void Digitizer::SaveSettingAsText(string fileName){
return;
}
Reg * haha = new Reg();
Reg haha;
for( unsigned int i = 0; i < SETTINGSIZE ; i++){
haha->SetName("");
uint32_t actualAddress = haha->CalAddress(i);
haha.SetName("");
uint32_t actualAddress = haha.CalAddress(i);
///printf("%7d--- 0x%04X, 0x%04X\n", i, haha->GetAddress(), haha->ActualAddress());
/// board setting
for( int p = 0; p < (int) RegisterDPPList.size(); p++){
if( haha->GetAddress() == (uint32_t) RegisterDPPList[p] ) haha->SetName(RegisterDPPList[p].GetName() );
if( haha.GetAddress() == (uint32_t) RegisterDPPList[p] ) haha = RegisterDPPList[p];
}
if( DPPType == V1730_DPP_PHA_CODE) {
for( int p = 0; p < (int) RegisterPHAList.size(); p++){
if( haha->GetAddress() == (uint32_t) RegisterPHAList[p] ) haha->SetName(RegisterPHAList[p].GetName() );
if( haha.GetAddress() == (uint32_t) RegisterPHAList[p] ) haha = RegisterPHAList[p];
}
}
if( DPPType == V1730_DPP_PSD_CODE) {
for( int p = 0; p < (int) RegisterPSDList.size(); p++){
if( haha->GetAddress() == (uint32_t) RegisterPSDList[p] ) haha->SetName(RegisterPSDList[p].GetName() );
if( haha.GetAddress() == (uint32_t) RegisterPSDList[p] ) haha = RegisterPSDList[p];
}
}
if( haha->GetName() != "" ) fprintf( txtFile, "0x%04X %35s 0x%08X %d\n", actualAddress, haha->GetNameChar(), setting[i], setting[i]);
if( haha.GetName() != "" ) {
std::string typeStr ;
if( haha.GetType() == RW::ReadWrite ) typeStr = "R/W";
if( haha.GetType() == RW::ReadONLY ) typeStr = "R ";
if( haha.GetType() == RW::WriteONLY ) typeStr = " W";
fprintf( txtFile, "0x%04X %30s 0x%08X %s %d\n", actualAddress,
haha.GetNameChar(),
setting[i],
typeStr.c_str(),
setting[i]);
}
}
delete haha;
}
void Digitizer::ErrorMsg(string header){

View File

@ -114,7 +114,6 @@ class Digitizer{
///================ Setting
/// board <--> memory functions
void ReadAllSettingsFromBoard ();
void SetSettingFromMemory (Reg registerAddress, int ch = -1); /// write to digitizer
void ProgramSettingsToBoard ();
/// simply read settings from memory
@ -124,12 +123,12 @@ class Digitizer{
unsigned int * GetSetting() {return setting;};
/// memory <--> file
void SaveSettingAsText (string fileName);
string GetSettingFileName() {return settingFileName;}
void OpenSettingBinary (string fileName); /// Open setting file, if file not exist, call CreateAndSaveSetiingFile, if file exit simple set the settignFileName
void LoadSettingBinary (string fileName); /// load settign file to memory, if digitizer connected, program digitizer
void SaveSettingToFile (Reg registerAddress, unsigned int value, int ch = -1);
unsigned int ReadSettingFromFile (Reg registerAddress, int ch = -1); /// read from setting binary
void SaveSettingAsText (string fileName);
///=================== Relic methods
///void SetRecordLength (unsigned int ns, int ch = -1); /// when ch == -1, mean set all channels