Cleaned, moved it to Mouse.cpp and Mouse.h files, optimised using array with binary args.
36 lines
855 B
C++
36 lines
855 B
C++
#include <iostream>
|
|
#include "Mouse.h"
|
|
|
|
int main() {
|
|
Mouse m;
|
|
int address, level, DPI_level;
|
|
int default_dpi = 3200;
|
|
m.init();
|
|
do {
|
|
m.listDevices();
|
|
std::cout << "Enter device address: ";
|
|
std::cin >> address;
|
|
}while(!m.selectDevice(address));
|
|
|
|
std::cout<<"Current backlight level: "<<(int)m.getBackLightLevel()<<std::endl;
|
|
|
|
do {
|
|
std::cout << "Select backlight level(0-3): ";
|
|
std::cin >> level;
|
|
}while(m.setBackLightLevel(level) < 0);
|
|
|
|
do {
|
|
std::cout << "Select DPI(100-4000): ";
|
|
std::cin >> DPI_level;
|
|
if(DPI_level < 100 || DPI_level > 4000) std::cout<<"Bad number. Try again!\n"<<std::endl;
|
|
}while(DPI_level < 100 || DPI_level > 4000);
|
|
|
|
printf("Setting it to %d, boss!\n", DPI_level);
|
|
int error = m.setDPI(DPI_level/100-1);
|
|
if(error != 0){
|
|
std::cout<<"Sorry boss, i cant... err: "<<(int)error<<std::endl;
|
|
}
|
|
return 0;
|
|
}
|
|
|