merged in sin_map from dev-faster

pull/78/head
alanbjohnston 5 years ago committed by GitHub
parent cb7a5af64a
commit 4f2823b739
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -118,6 +118,7 @@ int rpitxStatus = -1;
float amplitude; // = ; // 20000; // 32767/(10%amp+5%amp+100%amp)
float freq_Hz = 3000; // 1200
short int sin_samples;
int smaller;
int flip_ctr = 0;
@ -558,7 +559,15 @@ int main(int argc, char * argv[]) {
printf("\n BPSK Mode, bufLen: %d, %d bits per frame, %d bits per second, %d seconds per frame %d ms sample period\n",
bufLen, bufLen / (samples * frameCnt), bitRate, bufLen / (samples * frameCnt * bitRate), samplePeriod);
}
sin_samples = S_RATE/freq_Hz;
printf("Sin map: ");
for (int j = 0; j < sin_samples; j++) {
sin_map[j] = (short int)(amplitude * sin((float)(2 * M_PI * j / sin_samples)));
printf(" %d", sin_map[j]);
}
printf("\n");
}
long int loopTime;
loopTime = millis();
@ -1316,7 +1325,7 @@ else {
// printf("Smin %f Smax %f \n", sensor_min[count1], sensor_max[count1]);
}
if (mode == FSK) {
for (int count1 = 0; count1 < 8; count1++) {
if (voltage[count1] < voltage_min[count1])
voltage_min[count1] = voltage[count1];
@ -1344,7 +1353,7 @@ else {
// printf("Other min %f max %f \n", other_min[count1], other_max[count1]);
}
if (mode == FSK) {
// if (mode == FSK) {
if (loop % 8 == 0) {
printf("Sending MIN frame \n");
frm_type = 0x03;
@ -1975,10 +1984,11 @@ void write_wave(int i, short int *buffer)
else
{
if ((ctr - flip_ctr) < smaller)
buffer[ctr++] = (short int)(amplitude * 0.4 * phase * sin((float)(2*M_PI*i*freq_Hz/S_RATE)));
else
buffer[ctr++] = (short int)(amplitude * phase * sin((float)(2*M_PI*i*freq_Hz/S_RATE)));
}
// buffer[ctr++] = (short int)(amplitude * 0.4 * phase * sin((float)(2*M_PI*i*freq_Hz/S_RATE))); buffer[ctr++] = (short int)(amplitude * 0.4 * phase * sin((float)(2*M_PI*i*freq_Hz/S_RATE)));
buffer[ctr++] = (short int)(phase * sin_map[ctr % sin_samples] / 2);
else
// buffer[ctr++] = (short int)(amplitude * 0.4 * phase * sin((float)(2*M_PI*i*freq_Hz/S_RATE))); buffer[ctr++] = (short int)(amplitude * phase * sin((float)(2*M_PI*i*freq_Hz/S_RATE)));
buffer[ctr++] = (short int)(phase * sin_map[ctr % sin_samples]); }
// printf("%d %d \n", i, buffer[ctr - 1]);
}

Loading…
Cancel
Save

Powered by TurnKey Linux.