zapit/src/frontend.cpp: split current and rotor satellite positions

Origin commit data
------------------
Branch: ni/coolstream
Commit: a78961b721
Author: [CST] Focus <focus.cst@gmail.com>
Date: 2012-04-22 (Sun, 22 Apr 2012)


------------------
No further description and justification available within origin commit message!

------------------
This commit was generated by Migit
This commit is contained in:
[CST] Focus
2012-04-22 13:06:12 +04:00
parent 82646dbb03
commit a7de226449
2 changed files with 11 additions and 8 deletions

View File

@@ -112,6 +112,8 @@ class CFrontend
fe_sec_voltage_t currentVoltage;
/* current satellite position */
int32_t currentSatellitePosition;
/* rotor satellite position */
int32_t rotorSatellitePosition;
/* SETTINGS */
frontend_config_t config;
@@ -180,6 +182,7 @@ class CFrontend
void getDelSys(int f, int m, char * &fec, char * &sys, char * &mod);
int32_t getCurrentSatellitePosition() { return currentSatellitePosition; }
int32_t getRotorSatellitePosition() { return rotorSatellitePosition; }
void setDiseqcRepeats(const uint8_t repeats) { config.diseqcRepeats = repeats; }
void setDiseqcType(const diseqc_t type);
@@ -204,6 +207,7 @@ class CFrontend
const TP_params* getParameters(void) const { return &currentTransponder; };
struct dvb_frontend_event* setParametersResponse(TP_params *TP);
void setCurrentSatellitePosition(int32_t satellitePosition) {currentSatellitePosition = satellitePosition; }
void setRotorSatellitePosition(int32_t satellitePosition) {rotorSatellitePosition = satellitePosition; }
void positionMotor(uint8_t motorPosition);
void sendMotorCommand(uint8_t cmdtype, uint8_t address, uint8_t command, uint8_t num_parameters, uint8_t parameter1, uint8_t parameter2, int repeat = 0);

View File

@@ -1389,7 +1389,7 @@ int CFrontend::driveToSatellitePosition(t_satellite_position satellitePosition,
//if(config.diseqcType == DISEQC_ADVANCED) //FIXME testing
{
//printf("[fe%d] SatellitePosition %d -> %d\n", fenumber, currentSatellitePosition, satellitePosition);
//printf("[fe%d] SatellitePosition %d -> %d\n", fenumber, rotorSatellitePosition, satellitePosition);
bool moved = false;
sat_iterator_t sit = satellites.find(satellitePosition);
@@ -1400,14 +1400,14 @@ int CFrontend::driveToSatellitePosition(t_satellite_position satellitePosition,
new_position = sit->second.motor_position;
use_usals = sit->second.use_usals;
}
sit = satellites.find(currentSatellitePosition);
sit = satellites.find(rotorSatellitePosition);
if (sit != satellites.end())
old_position = sit->second.motor_position;
//printf("[fe%d] motorPosition %d -> %d usals %s\n", fenumber, old_position, new_position, use_usals ? "on" : "off");
printf("[fe%d] sat pos %d -> %d motor pos %d -> %d usals %s\n", fenumber, currentSatellitePosition, satellitePosition, old_position, new_position, use_usals ? "on" : "off");
printf("[fe%d] sat pos %d -> %d motor pos %d -> %d usals %s\n", fenumber, rotorSatellitePosition, satellitePosition, old_position, new_position, use_usals ? "on" : "off");
if (currentSatellitePosition == satellitePosition)
if (rotorSatellitePosition == satellitePosition)
return 0;
if (use_usals) {
@@ -1421,12 +1421,11 @@ int CFrontend::driveToSatellitePosition(t_satellite_position satellitePosition,
}
if (from_scan || (new_position > 0 && old_position > 0)) {
waitForMotor = config.motorRotationSpeed ? 2 + abs(satellitePosition - currentSatellitePosition) / config.motorRotationSpeed : 0;
waitForMotor = config.motorRotationSpeed ? 2 + abs(satellitePosition - rotorSatellitePosition) / config.motorRotationSpeed : 0;
}
if (moved) {
//currentSatellitePosition = satellitePosition;
waitForMotor = config.motorRotationSpeed ? 2 + abs(satellitePosition - currentSatellitePosition) / config.motorRotationSpeed : 0;
currentSatellitePosition = satellitePosition;
waitForMotor = config.motorRotationSpeed ? 2 + abs(satellitePosition - rotorSatellitePosition) / config.motorRotationSpeed : 0;
rotorSatellitePosition = satellitePosition;
}
}
//FIXME we never remember currentSatellitePosition for non-rotor ?