i have seen that this question in this vesc forums.
jennyxcy2008' question:
1:switch (comm_step) {
case 1: curr_samp_volt = (1 << 0) || (1 << 2); break;
case 2: curr_samp_volt = (1 << 1) || (1 << 2); break;
case 3: curr_samp_volt = (1 << 1) || (1 << 2); break;
case 4: curr_samp_volt = (1 << 0) || (1 << 1); break;
case 5: curr_samp_volt = (1 << 0) || (1 << 1); break;
case 6: curr_samp_volt = (1 << 0) || (1 << 2); break;
The code above, "||" should be "|" right?
what do you guys think about it?
if it is '||'
case 1: curr_samp_volt = 1; break;
case 2: curr_samp_volt = 1; break;
case 3: curr_samp_volt = 1; break;
case 4: curr_samp_volt = 1; break;
case 5: curr_samp_volt = 1; break;
case 6: curr_samp_volt = 1; break;
is this right?
if this is right, i think just only one might be going to activate below.
/////////////////////////////////////////////////////
if (curr_samp_volt & (1 << 0)) {
curr0 = GET_CURRENT1();
}
if (curr_samp_volt & (1 << 1)) {
curr1 = GET_CURRENT2();
}
#ifdef HW_HAS_3_SHUNTS
if (curr_samp_volt & (1 << 2)) {
curr2 = GET_CURRENT3();
}
#endif
/////////////////////////////////////////////////////
if it is '|'
case 1: curr_samp_volt = 5; break;
case 2: curr_samp_volt = 6; break;
case 3: curr_samp_volt = 6; break;
case 4: curr_samp_volt = 3; break;
case 5: curr_samp_volt = 3; break;
case 6: curr_samp_volt = 5; break;
i think, it doesn't need the below commands.
/////////////////////////////////////////////////////
if (curr_samp_volt & (1 << 0)) {
curr0 = GET_CURRENT1();
}
if (curr_samp_volt & (1 << 1)) {
curr1 = GET_CURRENT2();
}
#ifdef HW_HAS_3_SHUNTS
if (curr_samp_volt & (1 << 2)) {
curr2 = GET_CURRENT3();
}
#endif
/////////////////////////////////////////////////////
i am very very wondering.
if you guys have known this question. could you explain how to use?
and what does mean that "Use the voltage-synchronized samples for this current sample"?
thank you so much your interesting.