Rev 1955 | Rev 1963 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1955 | Rev 1960 | ||
---|---|---|---|
Line 127... | Line 127... | ||
127 | "AngleRoll ", |
127 | "AngleRoll ", |
128 | "AngleYaw ", |
128 | "AngleYaw ", |
129 | "GyroPitch(PID) ", |
129 | "GyroPitch(PID) ", |
130 | "GyroRoll(PID) ", |
130 | "GyroRoll(PID) ", |
131 | "GyroYaw ", //5 |
131 | "GyroYaw ", //5 |
132 | "AccPitch (raw) ", |
132 | "OffsPitch ", |
133 | "AccRoll (raw) ", |
133 | "OffsRoll ", |
134 | "AttitudeControl ", |
134 | "AttitudeControl ", |
135 | "AccPitch (angle)", |
135 | "AccPitch (angle)", |
136 | "AccRoll (angle) ", //10 |
136 | "AccRoll (angle) ", //10 |
137 | "UBat ", |
137 | "UBat ", |
138 | "Pitch Term ", |
138 | "Pitch Term ", |
Line 519... | Line 519... | ||
519 | break; |
519 | break; |
Line 520... | Line 520... | ||
520 | 520 | ||
521 | case 'n':// "Get Mixer Table |
521 | case 'n':// "Get Mixer Table |
522 | while (!txd_complete) |
522 | while (!txd_complete) |
523 | ; // wait for previous frame to be sent |
523 | ; // wait for previous frame to be sent |
524 | SendOutData('N', FC_ADDRESS, 1, (uint8_t *) &Mixer, sizeof(Mixer)); |
524 | SendOutData('N', FC_ADDRESS, 1, (uint8_t *) &mixerMatrix, sizeof(mixerMatrix)); |
Line 525... | Line 525... | ||
525 | break; |
525 | break; |
526 | 526 | ||
527 | case 'm':// "Set Mixer Table |
527 | case 'm':// "Set Mixer Table |
528 | if (pRxData[0] == EEMIXER_REVISION) { |
528 | if (pRxData[0] == EEMIXER_REVISION) { |
529 | memcpy(&Mixer, (uint8_t*) pRxData, sizeof(Mixer)); |
529 | memcpy(&mixerMatrix, (uint8_t*) pRxData, sizeof(mixerMatrix)); |
530 | MixerTable_WriteToEEProm(); |
530 | mixerMatrix_writeToEEProm(); |
531 | while (!txd_complete) |
531 | while (!txd_complete) |
532 | ; // wait for previous frame to be sent |
532 | ; // wait for previous frame to be sent |
533 | tempchar1 = 1; |
533 | tempchar1 = 1; |
Line 541... | Line 541... | ||
541 | request_PPMChannels = TRUE; |
541 | request_PPMChannels = TRUE; |
542 | break; |
542 | break; |
Line 543... | Line 543... | ||
543 | 543 | ||
544 | case 'q':// request settings |
544 | case 'q':// request settings |
545 | if (pRxData[0] == 0xFF) { |
545 | if (pRxData[0] == 0xFF) { |
546 | pRxData[0] = GetParamByte(PID_ACTIVE_SET); |
546 | pRxData[0] = getParamByte(PID_ACTIVE_SET); |
547 | } |
547 | } |
548 | // limit settings range |
548 | // limit settings range |
549 | if (pRxData[0] < 1) |
549 | if (pRxData[0] < 1) |
550 | pRxData[0] = 1; // limit to 1 |
550 | pRxData[0] = 1; // limit to 1 |
551 | else if (pRxData[0] > 5) |
551 | else if (pRxData[0] > 5) |
552 | pRxData[0] = 5; // limit to 5 |
552 | pRxData[0] = 5; // limit to 5 |
553 | // load requested parameter set |
553 | // load requested parameter set |
554 | ParamSet_ReadFromEEProm(pRxData[0]); |
554 | paramSet_readFromEEProm(pRxData[0]); |
555 | tempchar1 = pRxData[0]; |
555 | tempchar1 = pRxData[0]; |
556 | tempchar2 = EEPARAM_REVISION; |
556 | tempchar2 = EEPARAM_REVISION; |
557 | while (!txd_complete) |
557 | while (!txd_complete) |
558 | ; // wait for previous frame to be sent |
558 | ; // wait for previous frame to be sent |
Line 566... | Line 566... | ||
566 | { |
566 | { |
567 | if ((1 <= pRxData[0]) && (pRxData[0] <= 5) && (pRxData[1] |
567 | if ((1 <= pRxData[0]) && (pRxData[0] <= 5) && (pRxData[1] |
568 | == EEPARAM_REVISION)) // check for setting to be in range and version of settings |
568 | == EEPARAM_REVISION)) // check for setting to be in range and version of settings |
569 | { |
569 | { |
570 | memcpy(&staticParams, (uint8_t*) &pRxData[2], sizeof(staticParams)); |
570 | memcpy(&staticParams, (uint8_t*) &pRxData[2], sizeof(staticParams)); |
571 | ParamSet_WriteToEEProm(pRxData[0]); |
571 | paramSet_writeToEEProm(pRxData[0]); |
572 | tempchar1 = getActiveParamSet(); |
572 | tempchar1 = getActiveParamSet(); |
573 | beepNumber(tempchar1); |
573 | beepNumber(tempchar1); |
574 | } else { |
574 | } else { |
575 | tempchar1 = 0; //indicate bad data |
575 | tempchar1 = 0; //indicate bad data |
576 | } |
576 | } |
Line 732... | Line 732... | ||
732 | 732 | ||
733 | #ifdef USE_MK3MAG |
733 | #ifdef USE_MK3MAG |
734 | if((checkDelay(Compass_Timer)) && txd_complete) { |
734 | if((checkDelay(Compass_Timer)) && txd_complete) { |
735 | ToMk3Mag.Attitude[0] = (int16_t)((10 * angle[PITCH]) / GYRO_DEG_FACTOR_PITCHROLL); // approx. 0.1 deg |
735 | ToMk3Mag.Attitude[0] = (int16_t)((10 * angle[PITCH]) / GYRO_DEG_FACTOR_PITCHROLL); // approx. 0.1 deg |
736 | ToMk3Mag.Attitude[1] = (int16_t)((10 * angle[ROLL]) / GYRO_DEG_FACTOR_PITCHROLL); // approx. 0.1 deg |
736 | ToMk3Mag.Attitude[1] = (int16_t)((10 * angle[ROLL]) / GYRO_DEG_FACTOR_PITCHROLL); // approx. 0.1 deg |
737 | ToMk3Mag.UserParam[0] = dynamicParams.UserParams[0]; |
737 | ToMk3Mag.UserParam[0] = dynamicParams.userParams[0]; |
738 | ToMk3Mag.UserParam[1] = dynamicParams.UserParams[1]; |
738 | ToMk3Mag.UserParam[1] = dynamicParams.userParams[1]; |
739 | ToMk3Mag.CalState = compassCalState; |
739 | ToMk3Mag.CalState = compassCalState; |
740 | SendOutData('w', MK3MAG_ADDRESS, 1,(uint8_t *) &ToMk3Mag,sizeof(ToMk3Mag)); |
740 | SendOutData('w', MK3MAG_ADDRESS, 1,(uint8_t *) &ToMk3Mag,sizeof(ToMk3Mag)); |
741 | // the last state is 5 and should be send only once to avoid multiple flash writing |
741 | // the last state is 5 and should be send only once to avoid multiple flash writing |
742 | if(compassCalState > 4) compassCalState = 0; |
742 | if(compassCalState > 4) compassCalState = 0; |