Pre-merge commit.

main
roman 2023-12-10 21:33:38 +03:00
rodzic d28d20062a
commit d9bac8da61
7 zmienionych plików z 48 dodań i 29 usunięć

Wyświetl plik

@ -22,7 +22,7 @@ project(pico-wspr-tx C CXX ASM)
pico_sdk_init()
add_executable(pico-wspr-tx)
pico_generate_pio_header(pico-wspr-tx ${CMAKE_CURRENT_LIST_DIR}/pico-hf-oscillator/piodco/dco.pio)
pico_generate_pio_header(pico-wspr-tx ${CMAKE_CURRENT_LIST_DIR}/pico-hf-oscillator/piodco/dco2.pio)
target_sources(pico-wspr-tx PUBLIC
${CMAKE_CURRENT_LIST_DIR}/pico-hf-oscillator/lib/assert.c

Wyświetl plik

@ -113,7 +113,7 @@ TxChannelContext *TxChannelInit(const uint32_t bit_period_us, uint8_t timer_alar
/// @return A count of bytes.
uint8_t TxChannelPending(TxChannelContext *pctx)
{
return 256 + pctx->_ix_input - pctx->_ix_output;
return 256L + (int)pctx->_ix_input - (int)pctx->_ix_output;
}
/// @brief Push a number of bytes to the output FIFO.
@ -154,14 +154,3 @@ void TxChannelClear(TxChannelContext *pctx)
{
pctx->_ix_input = pctx->_ix_output = 0;
}
/*
void TxChannelStart(TxChannelContext *pctx)
{
pctx->_b_allowtx = YES;
}
void TxChannelStop(TxChannelContext *pctx)
{
pctx->_b_allowtx = NO;
}
*/

Wyświetl plik

@ -113,7 +113,7 @@ int WSPRbeaconSendPacket(const WSPRbeaconContext *pctx)
{
assert_(pctx);
assert_(pctx->_pTX);
assert_(pctx->_pTX->_u32_dialfreqhz > 1100 * kHz);
assert_(pctx->_pTX->_u32_dialfreqhz > 500 * kHz);
TxChannelClear(pctx->_pTX);

Wyświetl plik

@ -65,7 +65,6 @@ void Core1Entry()
assert_(pWSPR);
const uint32_t clkhz = PLL_SYS_MHZ * MHz;
const uint32_t freq_hz = pWSPR->_pTX->_u32_dialfreqhz;
PioDco *p = pWSPR->_pTX->_p_oscillator;
assert_(p);
@ -74,8 +73,8 @@ void Core1Entry()
assert_(0 == PioDCOInit(p, pWSPR->_pTX->_i_tx_gpio, clkhz));
/* Set initial freq. */
assert_(0 == PioDCOSetFreq(p, freq_hz, 0U));
assert_(0 == PioDCOSetFreq(p, pWSPR->_pTX->_u32_dialfreqhz, 0U));
/* Run the main DCO algorithm. It spins forever. */
PioDCOWorker(p);
PioDCOWorker2(p);
}

Wyświetl plik

@ -52,7 +52,7 @@
#ifndef DEFINESWSPR_H
#define DEFINESWSPR_H
//#define DEBUG
#define DEBUG
#ifdef DEBUG
#define DEBUGPRINTF(x) StampPrintf(x);

51
main.c
Wyświetl plik

@ -66,6 +66,13 @@
#include <logutils.h>
#include <protos.h>
#define CONFIG_GPS_SOLUTION_IS_MANDATORY NO
#define CONFIG_GPS_RELY_ON_PAST_SOLUTION NO
#define CONFIG_SCHEDULE_SKIP_SLOT_COUNT 5
#define CONFIG_WSPR_DIAL_FREQUENCY 24926000UL // 28126000UL //7040000UL
#define CONFIG_CALLSIGN "R2BDY"
#define CONFIG_LOCATOR4 "KO85"
WSPRbeaconContext *pWSPR;
int main()
@ -81,21 +88,20 @@ int main()
StampPrintf("WSPR beacon init...");
WSPRbeaconContext *pWB = WSPRbeaconInit(
"R2BDY", /* the Callsign. */
"KO85", /* the default QTH locator if GPS isn't used. */
16, /* Tx power, dbm. */
CONFIG_CALLSIGN,/* the Callsign. */
CONFIG_LOCATOR4,/* the default QTH locator if GPS isn't used. */
12, /* Tx power, dbm. */
&DCO, /* the PioDCO object. */
7040000UL, /* the dial frequency. */
CONFIG_WSPR_DIAL_FREQUENCY,
55UL, /* the carrier freq. shift relative to dial freq. */
RFOUT_PIN /* RF output GPIO pin. */
);
assert_(pWB);
pWSPR = pWB;
pWB->_txSched._u8_tx_GPS_mandatory = YES; /* Send WSPR signals only when GPS solution is active. */
pWB->_txSched._u8_tx_GPS_past_time = YES; /* ?relying on GPS solution in the past. */
pWB->_txSched._u8_tx_slot_skip = 5; /* 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_GPS_mandatory = CONFIG_GPS_SOLUTION_IS_MANDATORY;
pWB->_txSched._u8_tx_GPS_past_time = CONFIG_GPS_RELY_ON_PAST_SOLUTION;
pWB->_txSched._u8_tx_slot_skip = CONFIG_SCHEDULE_SKIP_SLOT_COUNT;
multicore_launch_core1(Core1Entry);
StampPrintf("RF oscillator started.");
@ -106,6 +112,7 @@ int main()
int tick = 0;
for(;;)
{
/*
if(WSPRbeaconIsGPSsolutionActive(pWB))
{
const char *pgps_qth = WSPRbeaconGetLastQTHLocator(pWB);
@ -115,8 +122,32 @@ int main()
pWB->_pu8_locator[5] = 0x00;
}
}
WSPRbeaconTxScheduler(pWB, YES);
*/
if(pWB->_txSched._u8_tx_GPS_mandatory)
{
WSPRbeaconTxScheduler(pWB, YES);
}
else
{
StampPrintf("Omitting GPS solution, start tx now.");
PioDCOStart(pWB->_pTX->_p_oscillator);
WSPRbeaconCreatePacket(pWB);
sleep_ms(100);
WSPRbeaconSendPacket(pWB);
StampPrintf("The system will be halted when tx is completed.");
for(;;)
{
if(!TxChannelPending(pWB->_pTX))
{
PioDCOStop(pWB->_pTX->_p_oscillator);
StampPrintf("System halted.");
}
gpio_put(PICO_DEFAULT_LED_PIN, 1);
sleep_ms(500);
gpio_put(PICO_DEFAULT_LED_PIN, 0);
}
}
gpio_put(PICO_DEFAULT_LED_PIN, 1);
sleep_ms(100);

@ -1 +1 @@
Subproject commit 01dbdefbaf1964246bfb66383ceeccea63aa6c60
Subproject commit 9fbd9fa407423c89af9c4878340e71446c948f66