コード例 #1
0
ファイル: dataRepository.c プロジェクト: spel-uchile/SUCHAI
/**
 * Borra todo el Fligth Plan
 */
void dat_erase_FlightPlan(void) {

#if (SCH_TFLIGHTPLAN_EXTMEMORY == 1)
#if (SCH_DATAREPOSITORY_VERBOSE>=1)
    printf("  dat_erase_FlightPlanBuff()..\n");
#endif

    unsigned long i;
    int cmdid, param;
    for(i=0; i < SCH_TFLIGHTPLAN_N_CMD; i++)
    {
        cmdid = CMD_CMDNULL;
        param = 0;

        dat_set_FlightPlan_cmd(i, cmdid);
        dat_set_FlightPlan_param(i, param);
    }
#elif (SCH_TFLIGHTPLAN_EXTMEMORY == 0)
    int i=0;
    for(i=0; i<SCH_TFLIGHTPLAN_N_CMD; i++)
    {
        DAT_FPLAN_BUFF[i] = CMD_CMDNULL; //Comandos
        DAT_FPLAN_BUFF[i+SCH_TFLIGHTPLAN_N_CMD]=0; //Parametros
    }
#endif
}
コード例 #2
0
ファイル: cmdDRP.c プロジェクト: keimi/SUCHAI
/*------------------------------------------------------------------------------
 *                              DRP_FLP_SET_PARAM
 *------------------------------------------------------------------------------
 * @brief             : Actualiza en el flight plan el valor del parametro
 *                      asociado al indice que contiene actualmente la variable
 *                      sta_fpl_index.
 * @return            : 1 - Success, 0 - Fail
 * ID                 : 0x5029
 *----------------------------------------------------------------------------*/
int drp_fpl_set_param(void *param)
{
    //Se recupera el comando y el indice
    int var = *((int *)param);
    int index = sta_get_stateVar(sta_fpl_index);

    //Se actualiza el flight plan
    int result = dat_set_FlightPlan_param(index, var);

    return result;
}
コード例 #3
0
ファイル: cmdDRP.c プロジェクト: keimi/SUCHAI
void drp_DAT_FlightPlan_EBF(void){
    #if (SCH_CMDDRP_VERBOSE>=1)
        printf("    Setting FligthPlan in launch configuration..\n");
    #endif
    
    #if (SCH_CMDDRP_VERBOSE>=1)
        printf("    Setting initial commands in FligthPlan..\n");
    #endif

    //aca debe ir la configuracion inicial del FligthPlan
    //esta es la configuracion a cargar antes del lanzamiento
    int index;
    for(index=0; index<SCH_FLIGHTPLAN_N_CMD; index++){
        if(index%2==0){
            dat_set_FlightPlan_cmd(index, ppc_id_get_osc);
            dat_set_FlightPlan_param(index, index);
        }
        else{
            dat_set_FlightPlan_cmd(index, rtc_id_print);
            dat_set_FlightPlan_param(index, index);
        }
    }
}
コード例 #4
0
ファイル: cmdDRP.c プロジェクト: keimi/SUCHAI
void drp_debug4(void){
    int value=0, res=0;
    unsigned int index;

    printf("DAT_TeleCmdBuff..\n");
    value=20000;
    for(index=0; index<SCH_DATAREPOSITORY_MAX_BUFF_TELECMD; index++, value++){

        printf("  writing: ");
        dat_set_TeleCmd_Buff(index, value);
        printf("    DAT_TeleCmdBuff[%u] = %d    |    ", index, value);

        printf("  reading: ");
        res = dat_get_TeleCmd_Buff(index);
        printf("    DAT_TeleCmdBuff[%u] = %d    |    ", index, res);

        printf("comparing: ");
        if( value==res ){ printf("ok\n"); }
        else{ con_printf("fail\n"); return; }

        ClrWdt();
    }

    printf("DAT_FlightPlanBuff..\n");
    value=1000; DispCmd NewCmd;
    for(index=0; index<(SCH_FLIGHTPLAN_N_CMD); index++, value++){

        printf("  writing: ");
        dat_set_FlightPlan_cmd(index, value);
        printf("    DAT_FlightPlanBuff[%u].cmd = %d    |    ", index, value);
        dat_set_FlightPlan_param(index, value+1);
        printf("    DAT_FlightPlanBuff[%u].param = %d    |    \n", index, value+1);
        

        printf("  reading: ");
        NewCmd = dat_get_FlightPlan(index);
        printf("    DAT_FlightPlanBuff[%u].cmd = %d    |    ", index, NewCmd.cmdId);
        printf("    DAT_FlightPlanBuff[%u].param = %d    |    \n", index, NewCmd.param);

        printf("  comparing: ");
        if( value==NewCmd.cmdId && (value+1)==NewCmd.param ){ printf("ok\n"); }
        else{ con_printf("fail\n"); return; }

        ClrWdt();
    }
    
    printf("DAT_NextPayBuff and DAT_MaxPayBuff..\n");
    int pay_i; int n=0, m=49, res1, res2;
    for(pay_i=0; pay_i<dat_pay_last_one; pay_i++, m=m+10){
        printf("  writing: ");
        dat_set_NextPayIndx(pay_i, n);
        printf("    DAT_NextPayBuff[%u] = %d    |    ", pay_i, n);
        dat_set_MaxPayIndx(pay_i, m);
        printf("    DAT_NextPayBuff[%u] = %d    |    \n", pay_i, m);

        printf("  reading: ");
        res1 = dat_get_NextPayIndx(pay_i);
        printf("    DAT_NextPayBuff[%u] = %d    |    ", pay_i, res1);
        res2 = dat_get_MaxPayIndx(pay_i);
        printf("    DAT_MaxPayBuff[%u] = %d    |    \n", pay_i, res2);

        printf("  comparing: ");
        if( n==res1 && m==res2 ){ printf("ok\n"); }
        else{ printf("fail\n"); return; }

        ClrWdt();
    }

    printf("DAT_Payload_Buff..\n");
    int maxind;
    for(pay_i=0; pay_i<dat_pay_last_one; pay_i++){
        value=20000; 
        maxind = dat_get_MaxPayIndx(pay_i);
        for(index=0; index<=maxind; index++, value++){

            printf("  writing: ");
            dat_set_Payload_Buff(pay_i, value, DAT_PAYBUFF_MODE_NO_MAXINDX);
            printf("    DAT_Payload_Buff[%u][%u] = %d    |    ",pay_i, index, value);
            printf("%d/%d [NextIndx/MaxIndx]   |    \n", dat_get_NextPayIndx(pay_i), dat_get_MaxPayIndx(pay_i) );

            printf("  reading: ");
            dat_get_Payload_Buff(pay_i, index, &res);
            printf("    DAT_Payload_Buff[%u][%u] = %d    |    \n",pay_i,  index, res);

            printf("  comparing: ");
            if( value==res ){ printf("ok\n"); }
            else{ con_printf("fail\n"); return; }

            ClrWdt();
        }
        printf("*******************************************\n");
    }

    printf("DAT_AuxBuff..\n");
    int aux_i; int maxind2;
    for(aux_i=0; aux_i<dat_aux_last_one; aux_i++){
        value=20000;
        maxind2 = 30;
        for(index=0; index<=maxind2; index++, value++){

            printf("  writing: ");
            dat_set_Aux_Buff(aux_i, index, value);
            printf("    DAT_AuxdBuff[%u] = %d    |    ", index, value);

            printf("  reading: ");
            res = dat_get_Aux_Buff(aux_i, index);
            printf("    DAT_AuxdBuff[%u] = %d    |    ", index, res);

            printf("  comparing: ");
            if( value==res ){ printf("ok\n"); }
            else{ con_printf("fail\n"); return; }

            ClrWdt();
        }
        printf("*******************************************\n");
    }
    printf("End of drp_debug4\n");
}