Skip to content

Commit

Permalink
Merge pull request #13 from n1zzo/main
Browse files Browse the repository at this point in the history
Fix bug in Ailunce HD1 flashing protocol
  • Loading branch information
v0l authored Mar 10, 2022
2 parents 9bcad64 + 6ce05ce commit a3bb96d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions src/ailunce_radio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include <thread>

#ifdef _WIN32
#define B57600 57600
#include <Windows.h>
#include <io.h>
#include <iostream>
Expand All @@ -35,6 +36,7 @@

#else
#include <unistd.h>
#include <termios.h>
#endif

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

//XOR raw binary data before sending
fw.Encrypt();


device.SetInterfaceAttribs(B57600, 0);
auto fd = device.GetFD();
// send 1 to start firmware upgrade
#ifdef _WIN32
Expand All @@ -62,7 +65,6 @@ auto AilunceRadio::WriteFirmware(const std::string &file) const -> void
std::this_thread::sleep_for(std::chrono::milliseconds(100));

auto r = fw.GetDataSegments()[0];
device.SetInterfaceAttribs(57600, 0);
device.Write(r.data);
}

Expand Down
2 changes: 1 addition & 1 deletion src/fymodem.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
/* error logging function */
#define YM_ERR(fmt, ...) do { printf(fmt, __VA_ARGS__); } while(0)

FILE* global_fd = 0;
int global_fd = 0;

char __ym_getchar(int timeout_ms)
{
Expand Down

0 comments on commit a3bb96d

Please sign in to comment.