Skip to content

Commit a3bb96d

Browse files
authored
Merge pull request #13 from n1zzo/main
Fix bug in Ailunce HD1 flashing protocol
2 parents 9bcad64 + 6ce05ce commit a3bb96d

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

src/ailunce_radio.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#include <thread>
2323

2424
#ifdef _WIN32
25+
#define B57600 57600
2526
#include <Windows.h>
2627
#include <io.h>
2728
#include <iostream>
@@ -35,6 +36,7 @@
3536

3637
#else
3738
#include <unistd.h>
39+
#include <termios.h>
3840
#endif
3941

4042
using namespace radio_tool::radio;
@@ -51,7 +53,8 @@ auto AilunceRadio::WriteFirmware(const std::string &file) const -> void
5153

5254
//XOR raw binary data before sending
5355
fw.Encrypt();
54-
56+
57+
device.SetInterfaceAttribs(B57600, 0);
5558
auto fd = device.GetFD();
5659
// send 1 to start firmware upgrade
5760
#ifdef _WIN32
@@ -62,7 +65,6 @@ auto AilunceRadio::WriteFirmware(const std::string &file) const -> void
6265
std::this_thread::sleep_for(std::chrono::milliseconds(100));
6366

6467
auto r = fw.GetDataSegments()[0];
65-
device.SetInterfaceAttribs(57600, 0);
6668
device.Write(r.data);
6769
}
6870

src/fymodem.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
/* error logging function */
5252
#define YM_ERR(fmt, ...) do { printf(fmt, __VA_ARGS__); } while(0)
5353

54-
FILE* global_fd = 0;
54+
int global_fd = 0;
5555

5656
char __ym_getchar(int timeout_ms)
5757
{

0 commit comments

Comments
 (0)