Changeset 42191 for titan/titan/frontenddev.h
- Timestamp:
- 04/27/18 17:47:39 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
titan/titan/frontenddev.h
r41930 r42191 111 111 } 112 112 113 node->feloffrequency_uni = 0; 114 113 115 if(satcrfrequ == 0) 114 116 { … … 125 127 else 126 128 { 127 int lof = (node->feaktband & 1) ? lofh : lofl; 128 unsigned int tmp = (frequency - lof) + satcrfrequ; 129 node->feloffrequency = (tmp / 4) - 350000; 130 node->feunicable = 1; 131 } 132 133 debug(200, "tuning to freq %d (befor lof %d), band=%d, unicable=%d", node->feloffrequency, frequency, node->feaktband, node->feunicable); 129 tmpstr = ostrcat(node->feshortname, "_lnb_satcr", 0, 0); 130 int satcr = getconfigint(tmpstr, node->feaktnr) - 1; 131 free(tmpstr); tmpstr = NULL; 132 if(satcr < 8) 133 { 134 int lof = (node->feaktband & 1) ? lofh : lofl; 135 unsigned int tmp = (frequency - lof) + satcrfrequ; 136 node->feloffrequency = (tmp / 4) - 350000; 137 node->feunicable = 1; 138 } 139 else 140 { 141 int lof = (node->feaktband & 1) ? lofh : lofl; 142 unsigned int tmp = (frequency - lof) - 100000; 143 node->feloffrequency = (1000 + 2 * tmp) / (2 *1000); //round to multiple of 1000 144 node->feloffrequency_uni = frequency - lof -(satcrfrequ - (satcrfrequ - (tmp - (1000 * node->feloffrequency)))); 145 node->feunicable = 1; 146 } 147 } 148 149 debug(200, "tuning to freq %d (befor lof %d), band=%d, unicable=%d unicableoff=%d", node->feloffrequency, frequency, node->feaktband, node->feunicable, node->feloffrequency_uni); 134 150 return node->feaktband; 135 151 } … … 1180 1196 free(tmpstr); tmpstr = NULL; 1181 1197 1182 unicabletune |= ((satcr & 0x7) << 13); 1183 unicabletune |= (((aktdiseqc - 1) & 0x1) << 12); 1184 unicabletune |= (((!node->feaktpolarization) & 0x1) << 11); 1185 unicabletune |= ((node->feaktband & 0x1) << 10); 1186 unicabletune |= ((node->feloffrequency / 1000) & 0x3ff); 1187 1188 debug(200, "unicabletune %04X", unicabletune); 1189 1190 if(status.firstunicablewait == 0) 1191 { 1192 status.firstunicablewait = getconfigint("firstunicablewait", NULL); 1198 if(satcr < 8) 1199 { 1200 int unicabletune = 0; 1201 1202 unicabletune |= ((satcr & 0x7) << 13); 1203 unicabletune |= (((aktdiseqc - 1) & 0x1) << 12); 1204 unicabletune |= (((!node->feaktpolarization) & 0x1) << 11); 1205 unicabletune |= ((node->feaktband & 0x1) << 10); 1206 unicabletune |= ((node->feloffrequency / 1000) & 0x3ff); 1207 1208 debug(200, "unicabletune %04X", unicabletune); 1209 1193 1210 if(status.firstunicablewait == 0) 1194 status.firstunicablewait = 1000; 1195 } 1196 1197 if(status.firstunicablewait > 0) 1198 { 1199 usleep(status.firstunicablewait * 1000); 1200 status.firstunicablewait = -1; 1201 } 1202 1203 fesetvoltage(node, SEC_VOLTAGE_13, 15); 1204 fesetvoltage(node, SEC_VOLTAGE_18, 15); 1205 fesettone(node, SEC_TONE_OFF, 15); 1206 1207 //feunicable 1208 //byte1 (bit 7/6/5) -> satcr number 1209 //byte1 (bit 4/3/2) -> lnb number 1210 //byte1 (bit 1/0) -> frequ 1211 //byte0 -> frequ 1212 1213 cmd.msg[0] = 0xE0; 1214 cmd.msg[1] = 0x10; 1215 cmd.msg[2] = 0x5A; 1216 cmd.msg[3] = (unicabletune >> 8) & 0xff; 1217 cmd.msg[4] = unicabletune & 0xff; 1218 cmd.msg_len = 5; 1211 { 1212 status.firstunicablewait = getconfigint("firstunicablewait", NULL); 1213 if(status.firstunicablewait == 0) 1214 status.firstunicablewait = 1000; 1215 } 1216 1217 if(status.firstunicablewait > 0) 1218 { 1219 usleep(status.firstunicablewait * 1000); 1220 status.firstunicablewait = -1; 1221 } 1222 1223 fesetvoltage(node, SEC_VOLTAGE_13, 15); 1224 fesetvoltage(node, SEC_VOLTAGE_18, 15); 1225 fesettone(node, SEC_TONE_OFF, 15); 1226 1227 //feunicable 1228 //byte1 (bit 7/6/5) -> satcr number 1229 //byte1 (bit 4/3/2) -> lnb number 1230 //byte1 (bit 1/0) -> frequ 1231 //byte0 -> frequ 1232 1233 cmd.msg[0] = 0xE0; 1234 cmd.msg[1] = 0x10; 1235 cmd.msg[2] = 0x5A; 1236 cmd.msg[3] = (unicabletune >> 8) & 0xff; 1237 cmd.msg[4] = unicabletune & 0xff; 1238 cmd.msg_len = 5; 1239 } 1240 else 1241 { 1242 uint64_t unicabletune = 0; 1243 1244 unicabletune |= ((satcr & 0x1F) << 19); 1245 unicabletune |= (((node->feloffrequency / 1000) & 0x7ff) << 8); 1246 unicabletune |= (((aktdiseqc - 1) & 0x1) << 2); 1247 unicabletune |= (((!node->feaktpolarization) & 0x1) << 1); 1248 unicabletune |= (node->feaktband & 0x1); 1249 1250 debug(200, "unicabletune %04X", unicabletune); 1251 1252 if(status.firstunicablewait == 0) 1253 { 1254 status.firstunicablewait = getconfigint("firstunicablewait", NULL); 1255 if(status.firstunicablewait == 0) 1256 status.firstunicablewait = 1000; 1257 } 1258 1259 if(status.firstunicablewait > 0) 1260 { 1261 usleep(status.firstunicablewait * 1000); 1262 status.firstunicablewait = -1; 1263 } 1264 1265 fesetvoltage(node, SEC_VOLTAGE_13, 15); 1266 fesetvoltage(node, SEC_VOLTAGE_18, 15); 1267 fesettone(node, SEC_TONE_OFF, 15); 1268 1269 //feunicable 2 1270 //byte2 (bit 7/6/5/4/3) -> satcr number 1271 //byte2 (bit 2/1/0) -> frequ 1272 //byte1 -> frequ 1273 //byte0 (bit 3/1/0) -> lnb number 1274 1275 cmd.msg[0] = 0x70; 1276 cmd.msg[1] = (unicabletune >> 16) & 0xff; 1277 cmd.msg[2] = (unicabletune >> 8) & 0xff; 1278 cmd.msg[3] = unicabletune & 0xff; 1279 cmd.msg_len = 4; 1280 } 1219 1281 1220 1282 debug(200, "send diseqc unicable cmd (%s)", node->feshortname); … … 1751 1813 { 1752 1814 fesetunicable(node); 1753 char* tmpstr = ostrcat(node->feshortname, "_lnb_satcrfrequ", 0, 0); 1754 node->feloffrequency = getconfigint(tmpstr, node->feaktnr) * 1000; 1755 free(tmpstr); tmpstr = NULL; 1815 if(node->feloffrequency_uni == 0) 1816 { 1817 char* tmpstr = ostrcat(node->feshortname, "_lnb_satcrfrequ", 0, 0); 1818 node->feloffrequency = getconfigint(tmpstr, node->feaktnr) * 1000; 1819 free(tmpstr); tmpstr = NULL; 1820 } 1821 else 1822 node->feloffrequency = node->feloffrequency_uni; 1756 1823 } 1757 1824
Note: See TracChangeset
for help on using the changeset viewer.