negativerad / eepe

Automatically exported from code.google.com/p/eepe
0 stars 0 forks source link

Throttle trim flipping during simulation #113

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Set in general settings Reverse Throttle Operation
2. Create e new model
3. Move throttle trims

What is the expected output? What do you see instead?
Trim stable and acting in the proper direction

What version of the product are you using? On what operating system?
285

Please provide any additional information below.
The problem is in the mixer loop of simulator.cpp
changing code in the following way fixes the problem:

    //========== MIXER LOOP ===============

    // Set the trim pointers back to the master set
    trimptr[0] = &trim[0] ;
    trimptr[1] = &trim[1] ;
    trimptr[2] = &trim[2] ;
    trimptr[3] = &trim[3] ;
    ui->trimHLeft->setValue( *trimptr[0]);  // mode=(0 || 1) -> rud trim else -> ail trim
    if ((g_eeGeneral.stickMode&1) && g_eeGeneral.throttleReversed==1) {
        ui->trimVLeft->setValue(-(*trimptr[1]));  // mode=(2 || 4) -> thr trim
    } else {
        ui->trimVLeft->setValue( *trimptr[1]);  // mode=(1 || 3) -> ele trim
    }
    if ((g_eeGeneral.stickMode&1) && g_eeGeneral.throttleReversed==1) {
        ui->trimVRight->setValue(*trimptr[2]);  // mode=(2 || 4) -> ele trim   
    } else {
        ui->trimVRight->setValue(-(*trimptr[2]));  // mode=(1 || 3) ->  thr trim
    }
    ui->trimHRight->setValue(*trimptr[3]);  // mode=(0 || 1) -> ail trim else -> rud trim

Original issue reported on code.google.com by romolo.m...@gmail.com on 6 Nov 2011 at 6:57

GoogleCodeExporter commented 9 years ago
the proper fix is the following
    //========== MIXER LOOP ===============

    // Set the trim pointers back to the master set
    trimptr[0] = &trim[0] ;
    trimptr[1] = &trim[1] ;
    trimptr[2] = &trim[2] ;
    trimptr[3] = &trim[3] ;
    ui->trimHLeft->setValue( *trimptr[0]);  // mode=(0 || 1) -> rud trim else -> ail trim
    if ((g_eeGeneral.stickMode&1) && g_eeGeneral.throttleReversed==1) {
        ui->trimVLeft->setValue(-(*trimptr[1]));  // mode=(2 || 4) -> thr trim
    } else {
        ui->trimVLeft->setValue( *trimptr[1]);  // mode=(1 || 3) -> ele trim
    }
    if ((g_eeGeneral.stickMode&1)) {
        ui->trimVRight->setValue(*trimptr[2]);  // mode=(2 || 4) -> ele trim   
    } else {
        if (g_eeGeneral.throttleReversed==1) {
                ui->trimVRight->setValue(-(*trimptr[2]));  // mode=(1 || 3) ->  thr trim
        } else {
                ui->trimVRight->setValue(*trimptr[2]);  // mode=(2 || 4) -> ele trim       
        }
    }
    ui->trimHRight->setValue(*trimptr[3]);  // mode=(0 || 1) -> ail trim else -> rud trim

Original comment by romolo.m...@gmail.com on 6 Nov 2011 at 7:03