Skip to content

Commit 66cf90d

Browse files
author
Simon Inns
authored
Merge pull request #19 from simoninns/release-1_3_prep
Release 1 3 prep
2 parents 5b025b9 + d220d6b commit 66cf90d

File tree

2 files changed

+26
-7
lines changed

2 files changed

+26
-7
lines changed

Makefile

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
CC=avr-gcc
2+
OBJCOPY=avr-objcopy
3+
OBJS=SmallyMouse2/main.o SmallyMouse2/ConfigDescriptor.o SmallyMouse2/src/LUFA/LUFA/Drivers/USB/Core/USBTask.o SmallyMouse2/src/LUFA/LUFA/Drivers/USB/Core/AVR8/USBController_AVR8.o SmallyMouse2/src/LUFA/LUFA/Drivers/USB/Core/AVR8/USBInterrupt_AVR8.o SmallyMouse2/src/LUFA/LUFA/Drivers/USB/Core/HostStandardReq.o SmallyMouse2/src/LUFA/LUFA/Drivers/USB/Core/ConfigDescriptors.o SmallyMouse2/src/LUFA/LUFA/Drivers/USB/Core/AVR8/Pipe_AVR8.o SmallyMouse2/src/LUFA/LUFA/Drivers/USB/Core/AVR8/PipeStream_AVR8.o SmallyMouse2/src/LUFA/LUFA/Drivers/USB/Core/AVR8/Host_AVR8.o SmallyMouse2/src/LUFA/LUFA/Drivers/Peripheral/AVR8/Serial_AVR8.o SmallyMouse2/src/LUFA/LUFA/Drivers/USB/Core/AVR8/Device_AVR8.o SmallyMouse2/src/LUFA/LUFA/Drivers/USB/Core/AVR8/Endpoint_AVR8.o SmallyMouse2/src/LUFA/LUFA/Drivers/USB/Core/Events.o
4+
5+
CFLAGS=-Os -DUSE_LUFA_CONFIG_HEADER -DARCH=ARCH_AVR8 -DBOARD=BOARD_NONE -DF_CPU=16000000UL -DF_USB=16000000UL -D__AVR_AT90USB1287__ -mmcu=at90usb1287 -ISmallyMouse2/src/ -ISmallyMouse2/src/config/ -ISmallyMouse2/src/LUFA/
6+
PORT=/dev/ttyACM0
7+
8+
smallymouse.hex: smallymouse.elf
9+
${OBJCOPY} -j .text -j .data -O ihex smallymouse.elf smallymouse.hex
10+
11+
smallymouse.elf: ${OBJS}
12+
${CC} -mmcu=at90usb1287 -o smallymouse.elf ${OBJS}
13+
14+
install: smallymouse.hex
15+
dfu-programmer at90usb1287 erase --force
16+
dfu-programmer at90usb1287 flash smallymouse.hex

SmallyMouse2/main.c

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ void initialiseHardware(void)
261261
Serial_CreateStream(NULL);
262262

263263
// Output some debug header information to the serial console
264-
puts_P(PSTR(ESC_FG_YELLOW "SmallyMouse2 - Serial debug console\r\n" ESC_FG_WHITE));
264+
puts_P(PSTR(ESC_FG_YELLOW "SmallyMouse2 V1.3 - Serial debug console\r\n" ESC_FG_WHITE));
265265
puts_P(PSTR(ESC_FG_YELLOW "(c)2017-2020 Simon Inns\r\n" ESC_FG_WHITE));
266266
puts_P(PSTR(ESC_FG_YELLOW "http://www.waitingforfriday.com\r\n" ESC_FG_WHITE));
267267

@@ -375,18 +375,20 @@ void processMouse(void)
375375
//
376376
// X and Y have a range of -127 to +127
377377

378-
// If the mouse movement changes direction then disregard any remaining
379-
// movement units in the previous direction.
378+
// If the mouse movement changes X direction then disregard any remaining movement
380379
if (MouseReport.X > 0 && mouseDirectionX == 0) {
381380
mouseDistanceX = 0;
382381
mouseDirectionX = 1;
383382
} else if (MouseReport.X < 0 && mouseDirectionX == 1) {
384383
mouseDistanceX = 0;
385384
mouseDirectionX = 0;
386-
} else if (MouseReport.Y > 0 && mouseDirectionY == 0) {
385+
}
386+
387+
// If the mouse movement changes Y direction then disregard any remaining movement
388+
if (MouseReport.Y > 0 && mouseDirectionY == 0) {
387389
mouseDistanceY = 0;
388390
mouseDirectionY = 1;
389-
} else if (MouseReport.Y < 0 && mouseDirectionY == 1) {
391+
} else if (MouseReport.Y < 0 && mouseDirectionY == 1) {
390392
mouseDistanceY = 0;
391393
mouseDirectionY = 0;
392394
}
@@ -516,8 +518,9 @@ uint8_t processMouseMovement(int8_t movementUnits, uint8_t axis, bool limitRate,
516518
// timerTopValue = timerTopValue / 64;
517519
// timerTopValue = timerTopValue - 1;
518520

519-
timerTopValue = ((10000 / timerTopValue) / 64) - 1;
520-
521+
if (timerTopValue > 0) timerTopValue = ((10000 / timerTopValue) / 64) - 1;
522+
else timerTopValue = 0; // Avoid divide by zero
523+
521524
// If the 'Slow' configuration jumper is shorted; apply the quadrature rate limit
522525
if (limitRate) {
523526
// Rate limit is on

0 commit comments

Comments
 (0)