The er9x expos conversions were wrong. Thanks to gbirkus for his tests!

This commit is contained in:
bsongis
2012-01-05 18:43:36 +00:00
parent debda06f8e
commit 9e0fd2a3d2
+16 -15
View File
@@ -137,26 +137,27 @@ uint8_t Translate()
memset(&g_model.expoData[0], 0, sizeof(expo4));
// expos conversion
uint8_t e = 0;
for (uint8_t ch=0; ch<4 && e<MAX_EXPOS; ch++) {
for (int8_t dr=2; dr>=0 && e<MAX_EXPOS; dr--) {
if ((dr==2 && !expo4[ch].drSw2) ||
(dr==1 && !expo4[ch].drSw1) ||
(dr==0 && !expo4[ch].expo[0][0][0] && !expo4[ch].expo[0][0][1] && !expo4[ch].expo[0][1][0] && !expo4[ch].expo[0][1][1])) continue;
g_model.expoData[e].swtch = (dr == 2 ? expo4[ch].drSw2 : (dr == 1 ? expo4[ch].drSw1 : 0));
for (uint8_t ch = 0; ch < 4 && e < MAX_EXPOS; ch++) {
for (uint8_t dr = 0, pos = 0; dr < 3 && e < MAX_EXPOS; dr++, pos++) {
if ((dr == 0 && !expo4[ch].drSw1) || (dr == 1 && !expo4[ch].drSw2))
dr = 2;
if (dr == 2 && !expo4[ch].expo[0][0][0] && !expo4[ch].expo[0][0][1] && !expo4[ch].expo[0][1][0] && !expo4[ch].expo[0][1][1])
break;
g_model.expoData[e].swtch = (dr == 0 ? -expo4[ch].drSw1 : (dr == 1 ? -expo4[ch].drSw2 : 0));
g_model.expoData[e].chn = ch;
g_model.expoData[e].expo = expo4[ch].expo[dr][0][0];
g_model.expoData[e].weight = 100 + expo4[ch].expo[dr][1][0];
if (expo4[ch].expo[dr][0][0] == expo4[ch].expo[dr][0][1] && expo4[ch].expo[dr][1][0] == expo4[ch].expo[dr][1][1]) {
g_model.expoData[e].expo = expo4[ch].expo[pos][0][0];
g_model.expoData[e].weight = 100 + expo4[ch].expo[pos][1][0];
if (expo4[ch].expo[pos][0][0] == expo4[ch].expo[pos][0][1] && expo4[ch].expo[pos][1][0] == expo4[ch].expo[pos][1][1]) {
g_model.expoData[e++].mode = 3;
}
else {
g_model.expoData[e].mode = 1;
if (e < MAX_EXPOS-1) {
g_model.expoData[e+1].swtch = g_model.expoData[e].swtch;
g_model.expoData[e].mode = 2;
if (e < MAX_EXPOS - 1) {
g_model.expoData[e + 1].swtch = g_model.expoData[e].swtch;
g_model.expoData[++e].chn = ch;
g_model.expoData[e].mode = 2;
g_model.expoData[e].expo = expo4[ch].expo[dr][0][1];
g_model.expoData[e++].weight = 100 + expo4[ch].expo[dr][1][1];
g_model.expoData[e].mode = 1;
g_model.expoData[e].expo = expo4[ch].expo[pos][0][1];
g_model.expoData[e++].weight = 100 + expo4[ch].expo[pos][1][1];
}
}
}