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

[new trarget] AIO #204

Merged
merged 20 commits into from
Jul 27, 2024
Merged
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
1 change: 1 addition & 0 deletions platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,5 @@ extra_configs =
targets/hdzero_race_v3.ini
targets/hdzero_freestyle_v2.ini
targets/hdzero_eco.ini
targets/hdzero_aio.ini

15 changes: 14 additions & 1 deletion src/camera.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ void camera_ratio_detect(void) {
case CAMERA_TYPE_RUNCAM_NANO_90:
camRatio = 1;
break;
#ifdef HDZERO_ECO
#ifdef USE_TP9950
case CAMERA_TYPE_OUTDATED:
camRatio = 1;
break;
Expand All @@ -74,10 +74,23 @@ void camera_mode_detect(uint8_t init) {

init = 0;

#ifdef USE_TC3587_RSTB
TC3587_RSTB = 0;
WAIT(100);
TC3587_RSTB = 1;
WAIT(100);
#endif

Set_720P60_8bit(0);

debugf("\r\nchipID");
id = I2C_Read8(ADDR_TP9950, 0xfe);
debugf("\r\n fe:%2x", id);
id = I2C_Read8(ADDR_TP9950, 0xff);
debugf("\r\n ff:%2x\r\n", id);
WAIT(200);

debugf("\r\nCamDetect");

Set_720P60_8bit(0);

Expand Down
7 changes: 7 additions & 0 deletions src/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
// #define HDZERO_RACE_V3
// #define HDZERO_FREESTYLE_V2
// #define HDZERO_ECO
// #define HDZERO_AIO

/* define VTX ID start */
#if defined HDZERO_WHOOP
Expand All @@ -37,6 +38,8 @@
#define VTX_ID 0x5b
#elif defined HDZERO_ECO
#define VTX_ID 0x5c
#elif defined HDZERO_AIO
#define VTX_ID 0x5d
#else
#define VTX_ID 0x00
#endif
Expand All @@ -60,6 +63,8 @@
#define VTX_NAME "HDZ FREESTYLE V2"
#elif defined HDZERO_ECO
#define VTX_NAME "HDZ ECO"
#elif defined HDZERO_AIO
#define VTX_NAME "HDZ AIO"
#else
#define VTX_NAME " "
#endif
Expand Down Expand Up @@ -137,6 +142,8 @@
#define SUART_PORT P0_3
#elif defined USE_TC3587_RSTB
#define TC3587_RSTB P0_3
#elif defined USE_USB_DET
#define USB_DET P0_3
#endif
#define CAM_PWM P0_4
#define BTN_1 P0_5
Expand Down
21 changes: 21 additions & 0 deletions src/hardware.c
Original file line number Diff line number Diff line change
Expand Up @@ -606,6 +606,9 @@ void TempDetect() {
#ifdef HDZERO_ECO
if (temp_new > 10)
temp_new -= 10;
#elif defined HDZERO_AIO
if (temp_new > 15)
temp_new -= 15;
#endif

temperature = temperature - (temperature >> 2) + temp_new;
Expand Down Expand Up @@ -1723,6 +1726,7 @@ void RF_Delay_Init() {
DM6300_AUXADC_Calib();
}
}

void reset_config() {
RF_FREQ = 0;
RF_POWER = 0;
Expand Down Expand Up @@ -1768,4 +1772,21 @@ uint8_t check_uart_loopback() {
return 0;
}
}
#endif

#ifdef USE_USB_DET
typedef void (*reset_mcu_ptr)(void);
reset_mcu_ptr reset_mcu = (reset_mcu_ptr)0x0000;

void usb_det_task() {
if (USB_DET == 1) {
LED_BLUE_OFF;
WriteReg(0, 0x8F, 0x10); // reset RF_chip
while (USB_DET == 1) {
WAIT(1);
}
// reset 5680
reset_mcu();
}
}
#endif
4 changes: 3 additions & 1 deletion src/hardware.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,9 @@ void vtx_paralized(void);

void timer_task();
void RF_Delay_Init();

#ifdef USE_USB_DET
void usb_det_task();
#endif
#if defined HDZERO_FREESTYLE_V1 || HDZERO_FREESTYLE_V2
extern uint8_t powerLock;
#endif
Expand Down
4 changes: 4 additions & 0 deletions src/mcu.c
Original file line number Diff line number Diff line change
Expand Up @@ -171,5 +171,9 @@ void main(void) {
runcam_shutter_fix(seconds);
}
RF_Delay_Init();

#ifdef USE_USB_DET
usb_det_task();
#endif
}
}
8 changes: 8 additions & 0 deletions targets/hdzero_aio.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[env:hdzero_aio]
extends = DM5680
build_flags =
${DM5680.build_flags}
-DHDZERO_AIO
-DUSE_TP9950
-DUSE_TEMPERATURE_SENSOR
-DUSE_USB_DET