kopia lustrzana https://github.com/RPiks/pico-WSPR-tx
Ongoing debugging.
rodzic
eb4a764605
commit
5a9f1cc01b
|
@ -150,7 +150,7 @@ void TxChannelClear(TxChannelContext *pctx)
|
||||||
{
|
{
|
||||||
pctx->_ix_input = pctx->_ix_output = 0;
|
pctx->_ix_input = pctx->_ix_output = 0;
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
void TxChannelStart(TxChannelContext *pctx)
|
void TxChannelStart(TxChannelContext *pctx)
|
||||||
{
|
{
|
||||||
pctx->_b_allowtx = YES;
|
pctx->_b_allowtx = YES;
|
||||||
|
@ -160,3 +160,4 @@ void TxChannelStop(TxChannelContext *pctx)
|
||||||
{
|
{
|
||||||
pctx->_b_allowtx = NO;
|
pctx->_b_allowtx = NO;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
|
@ -63,7 +63,7 @@ typedef struct
|
||||||
uint32_t _bit_period_us;
|
uint32_t _bit_period_us;
|
||||||
|
|
||||||
uint8_t _timer_alarm_num;
|
uint8_t _timer_alarm_num;
|
||||||
uint8_t _b_allowtx;
|
//uint8_t _b_allowtx;
|
||||||
|
|
||||||
uint8_t _ix_input, _ix_output;
|
uint8_t _ix_input, _ix_output;
|
||||||
uint8_t _pbyte_buffer[256];
|
uint8_t _pbyte_buffer[256];
|
||||||
|
@ -81,7 +81,7 @@ uint8_t TxChannelPending(TxChannelContext *pctx);
|
||||||
int TxChannelPush(TxChannelContext *pctx, uint8_t *psrc, int n);
|
int TxChannelPush(TxChannelContext *pctx, uint8_t *psrc, int n);
|
||||||
int TxChannelPop(TxChannelContext *pctx, uint8_t *pdst);
|
int TxChannelPop(TxChannelContext *pctx, uint8_t *pdst);
|
||||||
void TxChannelClear(TxChannelContext *pctx);
|
void TxChannelClear(TxChannelContext *pctx);
|
||||||
void TxChannelStart(TxChannelContext *pctx);
|
//void TxChannelStart(TxChannelContext *pctx);
|
||||||
void TxChannelStop(TxChannelContext *pctx);
|
//void TxChannelStop(TxChannelContext *pctx);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -115,8 +115,10 @@ int WSPRbeaconSendPacket(const WSPRbeaconContext *pctx)
|
||||||
assert_(pctx->_pTX);
|
assert_(pctx->_pTX);
|
||||||
assert_(pctx->_pTX->_u32_dialfreqhz > 1100 * kHz);
|
assert_(pctx->_pTX->_u32_dialfreqhz > 1100 * kHz);
|
||||||
|
|
||||||
|
TxChannelClear(pctx->_pTX);
|
||||||
|
|
||||||
memcpy(pctx->_pTX->_pbyte_buffer, pctx->_pu8_outbuf, WSPR_SYMBOL_COUNT);
|
memcpy(pctx->_pTX->_pbyte_buffer, pctx->_pu8_outbuf, WSPR_SYMBOL_COUNT);
|
||||||
pctx->_pTX->_ix_input += WSPR_SYMBOL_COUNT;
|
pctx->_pTX->_ix_input = WSPR_SYMBOL_COUNT;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -139,7 +141,8 @@ int WSPRbeaconTxScheduler(WSPRbeaconContext *pctx, int verbose)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(is_GPS_active || (is_GPS_override && u64_GPS_last_age_sec < 2 * HOUR))
|
if(is_GPS_active || (pctx->_pTX->_p_oscillator->_pGPStime->_time_data._u32_utime_nmea_last &&
|
||||||
|
is_GPS_override && u64_GPS_last_age_sec < 2 * HOUR))
|
||||||
{
|
{
|
||||||
const uint32_t u32_unixtime_now
|
const uint32_t u32_unixtime_now
|
||||||
= pctx->_pTX->_p_oscillator->_pGPStime->_time_data._u32_utime_nmea_last + u64_GPS_last_age_sec;
|
= pctx->_pTX->_p_oscillator->_pGPStime->_time_data._u32_utime_nmea_last + u64_GPS_last_age_sec;
|
||||||
|
@ -149,16 +152,16 @@ int WSPRbeaconTxScheduler(WSPRbeaconContext *pctx, int verbose)
|
||||||
const int islot_modulo = islot_number % pctx->_txSched._u8_tx_slot_skip;
|
const int islot_modulo = islot_number % pctx->_txSched._u8_tx_slot_skip;
|
||||||
|
|
||||||
static int itx_trigger = 0;
|
static int itx_trigger = 0;
|
||||||
|
//StampPrintf("Slot: %d %d %d", islot_number, islot_modulo, itx_trigger);
|
||||||
if(ZERO == islot_modulo)
|
if(ZERO == islot_modulo)
|
||||||
{
|
{
|
||||||
if(!itx_trigger)
|
if(!itx_trigger)
|
||||||
{
|
{
|
||||||
itx_trigger = 1;
|
itx_trigger = 1;
|
||||||
StampPrintf("Start TX.");
|
StampPrintf("WSPR> Start TX.");
|
||||||
|
|
||||||
WSPRbeaconCreatePacket(pctx);
|
|
||||||
|
|
||||||
PioDCOStart(pctx->_pTX->_p_oscillator);
|
PioDCOStart(pctx->_pTX->_p_oscillator);
|
||||||
|
WSPRbeaconCreatePacket(pctx);
|
||||||
sleep_ms(100);
|
sleep_ms(100);
|
||||||
WSPRbeaconSendPacket(pctx);
|
WSPRbeaconSendPacket(pctx);
|
||||||
}
|
}
|
||||||
|
@ -166,7 +169,7 @@ int WSPRbeaconTxScheduler(WSPRbeaconContext *pctx, int verbose)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
itx_trigger = 0;
|
itx_trigger = 0;
|
||||||
StampPrintf("Passive TX slot.");
|
StampPrintf("WSPR> Passive TX slot.");
|
||||||
PioDCOStop(pctx->_pTX->_p_oscillator);
|
PioDCOStop(pctx->_pTX->_p_oscillator);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -179,6 +182,10 @@ void WSPRbeaconDumpContext(const WSPRbeaconContext *pctx)
|
||||||
assert_(pctx);
|
assert_(pctx);
|
||||||
assert_(pctx->_pTX);
|
assert_(pctx->_pTX);
|
||||||
|
|
||||||
|
const uint64_t u64tmnow = GetUptime64();
|
||||||
|
const uint64_t u64_GPS_last_age_sec
|
||||||
|
= (u64tmnow - pctx->_pTX->_p_oscillator->_pGPStime->_time_data._u64_sysclk_nmea_last) / 1000000ULL;
|
||||||
|
|
||||||
StampPrintf("__________________");
|
StampPrintf("__________________");
|
||||||
StampPrintf("=TxChannelContext=");
|
StampPrintf("=TxChannelContext=");
|
||||||
StampPrintf("ftc:%llu", pctx->_pTX->_tm_future_call);
|
StampPrintf("ftc:%llu", pctx->_pTX->_tm_future_call);
|
||||||
|
@ -187,6 +194,8 @@ void WSPRbeaconDumpContext(const WSPRbeaconContext *pctx)
|
||||||
StampPrintf("gpo:%u", pctx->_pTX->_i_tx_gpio);
|
StampPrintf("gpo:%u", pctx->_pTX->_i_tx_gpio);
|
||||||
|
|
||||||
GPStimeContext *pGPS = pctx->_pTX->_p_oscillator->_pGPStime;
|
GPStimeContext *pGPS = pctx->_pTX->_p_oscillator->_pGPStime;
|
||||||
|
const uint32_t u32_unixtime_now
|
||||||
|
= pctx->_pTX->_p_oscillator->_pGPStime->_time_data._u32_utime_nmea_last + u64_GPS_last_age_sec;
|
||||||
assert_(pGPS);
|
assert_(pGPS);
|
||||||
StampPrintf("=GPStimeContext=");
|
StampPrintf("=GPStimeContext=");
|
||||||
StampPrintf("err:%ld", pGPS->_i32_error_count);
|
StampPrintf("err:%ld", pGPS->_i32_error_count);
|
||||||
|
@ -194,6 +203,8 @@ void WSPRbeaconDumpContext(const WSPRbeaconContext *pctx)
|
||||||
StampPrintf("sol:%u", pGPS->_time_data._u8_is_solution_active);
|
StampPrintf("sol:%u", pGPS->_time_data._u8_is_solution_active);
|
||||||
StampPrintf("unl:%lu", pGPS->_time_data._u32_utime_nmea_last);
|
StampPrintf("unl:%lu", pGPS->_time_data._u32_utime_nmea_last);
|
||||||
StampPrintf("snl:%llu", pGPS->_time_data._u64_sysclk_nmea_last);
|
StampPrintf("snl:%llu", pGPS->_time_data._u64_sysclk_nmea_last);
|
||||||
|
StampPrintf("age:%llu", u64_GPS_last_age_sec);
|
||||||
|
StampPrintf("utm:%lu", u32_unixtime_now);
|
||||||
StampPrintf("rmc:%lu", pGPS->_time_data._u32_nmea_gprmc_count);
|
StampPrintf("rmc:%lu", pGPS->_time_data._u32_nmea_gprmc_count);
|
||||||
StampPrintf("pps:%llu", pGPS->_time_data._u64_sysclk_pps_last);
|
StampPrintf("pps:%llu", pGPS->_time_data._u64_sysclk_pps_last);
|
||||||
StampPrintf("ppb:%lld", pGPS->_time_data._i32_freq_shift_ppb);
|
StampPrintf("ppb:%lld", pGPS->_time_data._i32_freq_shift_ppb);
|
||||||
|
|
34
main.c
34
main.c
|
@ -91,48 +91,24 @@ int main()
|
||||||
pWSPR = pWB;
|
pWSPR = pWB;
|
||||||
|
|
||||||
pWB->_txSched._u8_tx_GPS_mandatory = YES; /* Send WSPR signals only when GPS solution is active. */
|
pWB->_txSched._u8_tx_GPS_mandatory = YES; /* Send WSPR signals only when GPS solution is active. */
|
||||||
pWB->_txSched._u8_tx_GPS_past_time = NO; /* No relying on GPS sp;ution in the past. */
|
pWB->_txSched._u8_tx_GPS_past_time = YES; /* ?relying on GPS solution in the past. */
|
||||||
pWB->_txSched._u8_tx_slot_skip = 1; /* 1 slot tx, 1 slot idle, etc. */
|
pWB->_txSched._u8_tx_slot_skip = 2; /* 1 slot tx, 1 slot idle, etc. */
|
||||||
pWB->_txSched._u8_tx_heating_pause_min = 1; /* Give 1 minute pre-heating ere first transmition. */
|
pWB->_txSched._u8_tx_heating_pause_min = 1; /* Give 1 minute pre-heating ere first transmition. */
|
||||||
|
|
||||||
//sleep_ms(500);
|
|
||||||
multicore_launch_core1(Core1Entry);
|
multicore_launch_core1(Core1Entry);
|
||||||
StampPrintf("RF oscillator started.");
|
StampPrintf("RF oscillator started.");
|
||||||
|
|
||||||
DCO._pGPStime = GPStimeInit(0, 9600, GPS_PPS_PIN);
|
DCO._pGPStime = GPStimeInit(0, 9600, GPS_PPS_PIN);
|
||||||
assert_(DCO._pGPStime);
|
assert_(DCO._pGPStime);
|
||||||
//StampPrintf("PioDco ADDR: %p", pWSPR->_pTX->_p_oscillator);
|
|
||||||
//StampPrintf("GPSTime ADDR: %p %p", pWSPR->_pTX->_p_oscillator->_pGPStime, DCO._pGPStime);
|
|
||||||
|
|
||||||
|
int tick = 0;
|
||||||
for(;;)
|
for(;;)
|
||||||
{
|
{
|
||||||
WSPRbeaconTxScheduler(pWB, YES);
|
WSPRbeaconTxScheduler(pWB, YES);
|
||||||
|
|
||||||
//StampPrintf(".");
|
if(0 == ++tick % 10)
|
||||||
WSPRbeaconDumpContext(pWB);
|
WSPRbeaconDumpContext(pWB);
|
||||||
|
|
||||||
sleep_ms(1000);
|
sleep_ms(1000);
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
WSPRbeaconSetDialFreq(pWB, WSPR_DIAL_FREQ_HZ + WSPR_SHIFT_FREQ_HZ);
|
|
||||||
DEBUGPRINTF("OK");
|
|
||||||
|
|
||||||
DEBUGPRINTF("Create packet...");
|
|
||||||
WSPRbeaconCreatePacket(pWB);
|
|
||||||
DEBUGPRINTF("OK");
|
|
||||||
|
|
||||||
sleep_ms(100);
|
|
||||||
DEBUGPRINTF("Start oscillator on Core #1...");
|
|
||||||
multicore_launch_core1(Core1Entry);
|
|
||||||
DEBUGPRINTF("OK");
|
|
||||||
|
|
||||||
DEBUGPRINTF("Sending WSPR packet...");
|
|
||||||
WSPRbeaconSendPacket(pWB);
|
|
||||||
|
|
||||||
for(;;)
|
|
||||||
{
|
|
||||||
DEBUGPRINTF("tick.");
|
|
||||||
sleep_ms(1000);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
Ładowanie…
Reference in New Issue