From 50d1cb0c673ff55c6516c1264a54125db5d99f57 Mon Sep 17 00:00:00 2001 From: Sadeep Madurange Date: Tue, 6 May 2025 06:42:47 +0800 Subject: The damn R503 is responding! --- fpm.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'fpm.c') diff --git a/fpm.c b/fpm.c index 550a103..44f8b4c 100644 --- a/fpm.c +++ b/fpm.c @@ -43,7 +43,7 @@ static inline void send(uint8_t pktid, uint8_t *data, uint8_t n) write_bulk(addr, 4); write(pktid); - pktlen = n + 2; + pktlen = n + 3; write((uint8_t)(pktlen >> 8)); write((uint8_t)pktlen); @@ -123,8 +123,22 @@ static inline uint8_t check_pwd(void) buf[4] = (uint8_t)((uint32_t)FPM_PWD & 0xFF); send(0x01, buf, 5); + recv(buf, &n); + return buf[0] == OK; +} + +static inline void uint8_t aura_on(void) +{ + unsigned int n; + uint8_t buf[MAXPDLEN]; + + buf[0] = 0x35; + buf[1] = 0x01; + buf[2] = 0x00; + buf[3] = 0x01; + buf[4] = 0x00; - n = 0; + send(0x01, buf, 5); recv(buf, &n); return buf[0] == OK; } @@ -142,6 +156,7 @@ uint8_t fpm_init(void) UCSR0C = (1 << UCSZ01) | (1 << UCSZ00); _delay_ms(RST_DELAY_MS); + aura_on(); return check_pwd(); } -- cgit v1.2.3