fixed description of APRS SSID, more english variable names

pull/3/head
df8oe 2017-06-09 18:19:22 +02:00
commit 7117dfce82
2 zmienionych plików z 14 dodań i 62 usunięć

Wyświetl plik

@ -14,8 +14,7 @@ else()
CMAKE_FORCE_CXX_COMPILER(${TOOLCHAIN_DIR}/arm-none-eabi-g++.exe GNU)
endif()
project(STM32_RTTY C CXX ASM)
project(STM32_RTTY C ASM CXX)
add_definitions(-DSTM32F100C8)
add_definitions(-DSTM32F10X_MD_VL)
@ -23,8 +22,6 @@ add_definitions(-DUSE_STDPERIPH_DRIVER)
add_definitions(-DSUPPORT_CPLUSPLUS)
add_definitions(-D__ASSEMBLY__)
SET(LINKER_SCRIPT ${PROJECT_SOURCE_DIR}/arm-gcc-link.ld)
SET(COMMON_FLAGS " -mcpu=cortex-m3 -mthumb -Wall -ffunction-sections -g -O3 -g -nostartfiles ")
SET(CMAKE_CXX_FLAGS "${COMMON_FLAGS} -std=c++11")

71
main.c
Wyświetl plik

@ -14,6 +14,7 @@
#include <string.h>
#include <misc.h>
#include "f_rtty.h"
#include "fun.h"
#include "init.h"
#include "config.h"
#include "radio.h"
@ -30,12 +31,11 @@ char callsign[15] = {CALLSIGN};
unsigned int send_cun; //frame counter
char status[2] = {'N'};
int voltage;
int napiecie;
volatile char flaga = 0;
volatile char flaga = 0;//((((tx_delay / 1000) & 0x0f) << 3) | Smoc);
uint16_t CRC_rtty = 0x12ab; //checksum
char buf_rtty[200];
volatile unsigned char pun = 0;
volatile unsigned int cun = 10;
volatile unsigned char tx_on = 0;
@ -45,11 +45,7 @@ rttyStates send_rtty_status = rttyZero;
volatile char *rtty_buf;
volatile uint16_t button_pressed = 0;
volatile uint8_t disable_armed = 0;
void send_rtty_packet();
uint16_t gps_CRC16_checksum (char *string);
// int srednia (int dana);
/**
* GPS data processing
@ -57,7 +53,7 @@ uint16_t gps_CRC16_checksum (char *string);
void USART1_IRQHandler(void) {
if (USART_GetITStatus(USART1, USART_IT_RXNE) != RESET) {
ublox_handle_incoming_byte((uint8_t) USART_ReceiveData(USART1));
}else if (USART_GetITStatus(USART1, USART_IT_ORE) != RESET) {
}else if (USART_GetITStatus(USART1, USART_IT_ORE) != RESET) {
USART_ReceiveData(USART1);
} else {
USART_ReceiveData(USART1);
@ -71,7 +67,7 @@ void TIM2_IRQHandler(void) {
if (aprs_is_active()){
aprs_timer_handler();
} else {
if (tx_on) {
if (tx_on /*&& ++cun_rtty == 17*/) {
send_rtty_status = send_rtty((char *) rtty_buf);
if (!disable_armed){
if (send_rtty_status == rttyEnd) {
@ -147,11 +143,11 @@ int main(void) {
radio_rw_register(0x03, 0xff, 0);
radio_rw_register(0x04, 0xff, 0);
radio_soft_reset();
// setting TX frequency
// programowanie czestotliwosci nadawania
radio_set_tx_frequency(RTTY_FREQUENCY);
// setting TX power
radio_rw_register(0x6D, 00 | (TX_POWER & 0x0007), 1);
// Programowanie mocy nadajnika
radio_rw_register(0x6D, 00 | (Smoc & 0x0007), 1);
radio_rw_register(0x71, 0x00, 1);
radio_rw_register(0x87, 0x08, 0);
@ -171,7 +167,6 @@ int main(void) {
radio_enable_tx();
uint8_t rtty_before_aprs_left = RTTY_TO_APRS_RATIO;
while (1) {
if (tx_on == 0 && tx_enable) {
if (rtty_before_aprs_left){
@ -184,8 +179,7 @@ int main(void) {
ublox_get_last_data(&gpsData);
USART_Cmd(USART1, DISABLE);
int8_t temperature = radio_read_temperature();
// uint16_t voltage = (uint16_t) srednia(ADCVal[0] * 600 / 4096);
uint16_t voltage = (uint16_t) ADCVal[0] * 600 / 4096;
uint16_t voltage = (uint16_t) srednia(ADCVal[0] * 600 / 4096);
aprs_send_position(gpsData, temperature, voltage);
USART_Cmd(USART1, ENABLE);
radio_disable_tx();
@ -202,15 +196,14 @@ void send_rtty_packet() {
start_bits = RTTY_PRE_START_BITS;
int8_t si4032_temperature = radio_read_temperature();
// voltage = srednia(ADCVal[0] * 600 / 4096);
voltage = ADCVal[0] * 600 / 4096;
napiecie = srednia(ADCVal[0] * 600 / 4096);
GPSEntry gpsData;
ublox_get_last_data(&gpsData);
if (gpsData.fix >= 3) {
flaga |= 0x80;
} else {
flaga &= ~0x80;
}
}
uint8_t lat_d = (uint8_t) abs(gpsData.lat_raw / 10000000);
uint32_t lat_fl = (uint32_t) abs(abs(gpsData.lat_raw) - lat_d * 10000000) / 100;
uint8_t lon_d = (uint8_t) abs(gpsData.lon_raw / 10000000);
@ -223,7 +216,7 @@ void send_rtty_packet() {
(gpsData.alt_raw / 1000), si4032_temperature, voltage, gpsData.sats_raw,
gpsData.ok_packets, gpsData.bad_packets,
flaga);
CRC_rtty = 0xffff; //possibly not neccessary??
CRC_rtty = 0xffff; // maybe not neccessary??
CRC_rtty = gps_CRC16_checksum(buf_rtty + 4);
sprintf(buf_rtty, "%s*%04X\n", buf_rtty, CRC_rtty & 0xffff);
rtty_buf = buf_rtty;
@ -233,47 +226,9 @@ void send_rtty_packet() {
send_cun++;
}
uint16_t gps_CRC16_checksum(char *string) {
uint16_t crc = 0xffff;
char i;
while (*(string) != 0) {
crc = crc ^ (*(string++) << 8);
for (i = 0; i < 8; i++) {
if (crc & 0x8000)
crc = (uint16_t) ((crc << 1) ^ 0x1021);
else
crc <<= 1;
}
}
return crc;
}
/*
int srednia(int dana) {
static uint8_t nr_pom = 0;
static uint8_t first = 1;
int srednia_u[5] = {0, 0, 0, 0, 0};
uint8_t i;
int sr = 0;
if (first) {
for (i = 0; i < 5; i++) {
srednia_u[i] = dana;
}
first = 0;
}
srednia_u[nr_pom] = dana;
if (++nr_pom > 4) {
nr_pom = 0;
}
for (i = 0; i < 5; i++) {
sr += srednia_u[i];
}
sr = sr / 5;
return sr;
}
*/
#ifdef DEBUG
void assert_failed(uint8_t* file, uint32_t line)
{
while (1);
}
#endif
#endif