Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some fix #5566

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 42 additions & 4 deletions radio/src/edgetx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,33 @@ void checkValidMCU(void)
#endif
}

#if defined(RADIO_V16)

//extern bool VoiceRunStatus;

void per1ms()
{
//if(VoiceRunStatus==false)return; //cli updata

#if defined(IMU_SENSOR)
static uint16_t per1msloop=0;

//GetIMU42627(per1msloop);

if(++per1msloop>=5)
{
per1msloop=0;
}
else
#endif
{
#if defined(CSD203_SENSOR) && !defined(SIMU)
readCSD203();
#endif
}
}
#endif

void timer_10ms()
{
DEBUG_TIMER_START(debugTimerPer10ms);
Expand Down Expand Up @@ -213,10 +240,6 @@ void timer_10ms()
}
#endif

#if defined(CSD203_SENSOR) && !defined(SIMU)
readCSD203();
#endif

telemetryInterrupt10ms();

// These moved here from evalFlightModeMixes() to improve beep trigger reliability.
Expand Down Expand Up @@ -410,6 +433,21 @@ void generalDefault()
g_eeGeneral.chkSum = 0xFFFF;
}

uint16_t MaxAbnormalCurrent(void)
{
//if(g_eeGeneral.extmaxcurrent<200)return 200;

return 2000; //g_eeGeneral.extmaxcurrent;
}
uint8_t getvoivech56switch(void)
{
return 0; // g_eeGeneral.voivech56switch; //0=enable 1=disable
}
uint8_t getextModuleprotect(void)
{
return 0; // g_eeGeneral.extModuleprotect;
}

uint16_t evalChkSum()
{
uint16_t sum = 0;
Expand Down
1 change: 1 addition & 0 deletions radio/src/targets/common/arm/stm32/bootloader/boot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ FlashCheckRes valid;
MemoryType memoryType;
uint32_t unlocked = 0;

void per1ms() {} // make linker happy
void per5ms() {} // make linker happy

void per10ms()
Expand Down
9 changes: 9 additions & 0 deletions radio/src/targets/common/arm/stm32/pwr_driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,15 @@ void pwrInit()
#endif
}

#if defined(CSD203_SENSOR)
void EXTERNALMODULEOFF(void)
{
//EXTERNAL_MODULE_OFF();
//EXTERNAL_MODULE_PWR_OFF();
EXTERNAL_MODULE_PWR_OFF();
}
#endif

void pwrOn()
{
#if defined(PWR_ON_GPIO)
Expand Down
3 changes: 3 additions & 0 deletions radio/src/targets/common/arm/stm32/timers_driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,9 @@ static inline void _interrupt_1ms()

per10ms();
}
#if defined(RADIO_V16)
per1ms();
#endif
}

extern "C" void MS_TIMER_IRQHandler()
Expand Down
1 change: 1 addition & 0 deletions radio/src/targets/common/arm/stm32/timers_driver.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,6 @@ uint32_t timersGetMsTick();
uint32_t timersGetUsTick();

// declared "weak", to be implemented by application
void per1ms();
void per5ms();
void per10ms();
32 changes: 23 additions & 9 deletions radio/src/targets/horus/board.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,20 @@ void boardBLInit()
#if defined(SIXPOS_SWITCH_INDEX)
uint8_t lastADCState = 0;
uint8_t sixPosState = 0;
uint16_t adcValueold = 0;
uint16_t posstatus = 0;
bool dirty = true;

uint16_t getSixPosAnalogValue(uint16_t adcValue)
{
uint8_t currentADCState = 0;
uint16_t adc = 0;

if(++posstatus<6){
return (4096/5)*(sixPosState);
}
posstatus=0;

if (adcValue > 3800)
currentADCState = 6;
else if (adcValue > 3100)
Expand All @@ -101,20 +111,29 @@ uint16_t getSixPosAnalogValue(uint16_t adcValue)
currentADCState = 2;
else if (adcValue > 400)
currentADCState = 1;
if (lastADCState != currentADCState) {

if(adcValueold>adcValue)adc=adcValueold-adcValue;
else adc=adcValue-adcValueold;
if(adc>10){
adcValueold=adcValue;
currentADCState=0;
}
if (lastADCState != currentADCState&&currentADCState!=0) {
lastADCState = currentADCState;
} else if (lastADCState != 0 && lastADCState - 1 != sixPosState) {
}
else if (lastADCState != 0 && lastADCState - 1 != sixPosState) {
sixPosState = lastADCState - 1;
dirty = true;
}
if (dirty) {
for (uint8_t i = 0; i < 6; i++) {
if (i == sixPosState)
ws2812_set_color(i, SIXPOS_LED_RED, SIXPOS_LED_GREEN, SIXPOS_LED_BLUE);
ws2812_set_color(i, SIXPOS_LED_RED, 0, 0);
else
ws2812_set_color(i, 0, 0, 0);
}
ws2812_update(&_led_timer);
dirty = false;
}
return (4096/5)*(sixPosState);
}
Expand All @@ -127,18 +146,13 @@ void boardInit()
board_set_bor_level();
#endif

#if defined(FUNCTION_SWITCHES) && !defined(DEBUG)
#if defined(FUNCTION_SWITCHES) && !defined(DEBUG_DISABLE_USB)
// This is needed to prevent radio from starting when usb is plugged to charge
usbInit();
// prime debounce state...
usbPlugged();
if (usbPlugged()) {
delaysInit();
#if defined(AUDIO_MUTE_GPIO)
// Charging can make a buzzing noise
gpio_init(AUDIO_MUTE_GPIO, GPIO_OUT, GPIO_PIN_SPEED_LOW);
gpio_set(AUDIO_MUTE_GPIO);
#endif
while (usbPlugged()) {
delay_ms(1000);
}
Expand Down
Loading
Loading