|
Back
Midas
Rome
Roody
Rootana
|
Midas DAQ System |
Not logged in |
|
|
30 Apr 2024, Luigi Vigani, Bug Report, Params not initialized when starting sequencer
|
03 May 2024, Zaher Salman, Bug Report, Params not initialized when starting sequencer
|
03 May 2024, Stefan Ritt, Bug Report, Params not initialized when starting sequencer
|
03 May 2024, Luigi Vigani, Bug Report, Params not initialized when starting sequencer
|
03 May 2024, Zaher Salman, Bug Report, Params not initialized when starting sequencer
|
03 May 2024, Stefan Ritt, Bug Report, Params not initialized when starting sequencer
|
03 May 2024, Zaher Salman, Bug Report, Params not initialized when starting sequencer
|
03 May 2024, Stefan Ritt, Bug Report, Params not initialized when starting sequencer
|
10 May 2024, Zaher Salman, Bug Report, Params not initialized when starting sequencer
|
13 May 2024, Luigi Vigani, Bug Report, Params not initialized when starting sequencer
|
21 May 2024, Thomas Senger, Bug Report, Params not initialized when starting sequencer
|
21 May 2024, Zaher Salman, Bug Report, Params not initialized when starting sequencer
|
21 May 2024, Zaher Salman, Bug Report, Params not initialized when starting sequencer
|
22 May 2024, Thomas Senger, Bug Report, Params not initialized when starting sequencer
|
30 Aug 2024, Zaher Salman, Bug Report, Params not initialized when starting sequencer
|
04 Sep 2024, Lukas Gerritzen, Bug Report, Params not initialized when starting sequencer
|
04 Sep 2024, Zaher Salman, Bug Report, Params not initialized when starting sequencer
|
|
Message ID: 2823
Entry time: 04 Sep 2024
In reply to: 2822
|
Author: |
Zaher Salman |
Topic: |
Bug Report |
Subject: |
Params not initialized when starting sequencer |
|
|
The problem here was that the JS code did not wait to msequencer to finish preparing the "/Sequencer/Param" in the ODB, so I had to change to code to wait for "/Sequencer/Command/Load new file" to be false before proceeding.
As for your problem I recommend that you handle in the following way:
mjsonrpc_db_paste(paths,values).then(function (rpc) {
if (rpc.result.status.every(status => status === 1) {
// do something
} else {
// failed to set values, do something else
}
}).catch(function (error) {
console.error(error);
});
alternatively (for a single ODB) you can use the checkODBValue() function in sequencer.js. This function monitors a specific ODB path until it reaches a specific value and then calls funcCall with args.
var NcheckValue = 0;
// What for ODB in path to have value
// If value is not reached, give up after 10s
function checkODBValue(path,value,funcCall,args) {
/* Arguments:
path - ODB path to monitor for value
value - the value to be reached and return success
funcCall - function name to call when value is reached
args - argument to pass to funcCall
*/
// Call the mjsonrpc_db_get_values function
mjsonrpc_db_get_values([path]).then(function(rpc) {
if (rpc.result.status[0] === 1 && rpc.result.data[0] !== value) {
console.log("Value not reached yet", NcheckValue);
NcheckValue++;
if (NcheckValue < 100) {
// Wait 0.1 second and then call checkODBValue again
// Time out after 10 s
setTimeout(() => {
checkODBValue(path,value,funcCall,args);
}, 100);
}
} else {
if (funcCall) funcCall(args);
console.log("Value reached, proceeding...");
// reset counter
NcheckValue = 0;
}
}).catch(function(error) {
console.error(error);
});
}
Lukas Gerritzen wrote: | I think I have had similar issues in a custom page, where I wrote values to the ODB and they were not ready when I needed them. If you found a fix to such race conditions, could you maybe share how to properly treat this issue? If the solution reliably works, we could also consider including it in the documentation (midaswiki or example.html).
Zaher Salman wrote: | The issue with the parameters should be fixed now. Please test and let me know if it still happens.
|
|
|