/QMK-Groundstation/branches/libMK/eeepc.pro |
---|
8,7 → 8,3 |
INCLUDEPATH += $(HOME)/include /usr/include/qwt-qt4 |
include(global.pri) |
HEADERS += libMK/FlightLog.h |
SOURCES += libMK/FlightLog.cpp |
/QMK-Groundstation/branches/libMK/libMK/FlightLog.cpp |
---|
16,7 → 16,7 |
char buffer [20]; |
timeval timestamp; |
gettimeofday(×tamp, 0); |
sprintf(buffer, "%i.%03i", timestamp.tv_sec, (timestamp.tv_usec+500)/1000); |
sprintf(buffer, "%i.%07i", timestamp.tv_sec, timestamp.tv_usec); |
//alternative to show human readable output |
/* |
time_t rawtime; |
40,8 → 40,8 |
printf("%c", data[i]); |
} |
printf(" hex:"); |
for( int i = 0 ; i < length ; i++ ){ |
printf( "%02hhx " , data[i] ); |
for( int i = 0 ; i < length ; i++ ){ |
printf( "%02hhx " , data[i] ); |
} |
printf( "\n" ); |
} |
/QMK-Groundstation/branches/libMK/libMK/Handler.cpp |
---|
69,7 → 69,9 |
com->send_cmd('m', ADDRESS_FC, tx_data, length, true); |
} |
//FIXME: implement me! |
int Handler::get_motor_config(char * tx_data) { |
FlightLog::error("get motor config not implemented"); |
return -1; |
} |
/QMK-Groundstation/branches/libMK/libMK/Makefile |
---|
7,7 → 7,7 |
CXXINCS = -I"./" -I"../" |
CXXFLAGS = $(CXXINCS) -O3 |
LINKOBJ = Kopter.o FlightLog.o Parser.o Communication.o Handler.o |
LINKOBJ = Kopter.o FlightLog.o Parser.o Communication.o Handler.o TestingCommunication.o |
all: all-before $(LINKOBJ) |
/QMK-Groundstation/branches/libMK/libMK/TestingCommunication.cpp |
---|
0,0 → 1,0 |
/QMK-Groundstation/branches/libMK/libMK/TestingCommunication.h |
---|
0,0 → 1,24 |
#ifndef TESTING_COMMUNICATION_H |
#define TESTING_COMMUNICATION_H |
#include "Communication.h" |
#include "Handler.h" |
#include "FlightLog.h" |
/** |
* Dummy class that stores the communication data for testing |
*/ |
class TestingCommunication : public Communication { |
private: |
Handler * handler; |
char * data; |
public: |
TestingCommunication(Handler * handler); |
void connect_MK(char * addr); |
void received_data(char * data, int length); |
void send_cmd(char cmd, int address, char data[150], unsigned int length, bool resend); |
void stop_resend(); |
void get_data(char * data); |
}; |
#endif |
/QMK-Groundstation/branches/libMK/libMK |
---|
Property changes: |
Added: svn:ignore |
+depend |
/QMK-Groundstation/branches/libMK/libMK.pri |
---|
8,9 → 8,11 |
Handler.h \ |
Kopter.h \ |
Parser.h \ |
QTSerialCommunication.h |
QTSerialCommunication.h \ |
FlightLog.h |
SOURCES += Communication.cpp \ |
Handler.cpp \ |
Parser.cpp \ |
QTSerialCommunication.cpp |
QTSerialCommunication.cpp \ |
FlightLog.cpp |
QT += network |
/QMK-Groundstation/branches/libMK/testing/HandlerTest.cpp |
---|
1,12 → 1,112 |
#include "HandlerTest.h" |
#include <iostream> |
void HandlerTest::setUp(void) { |
std::cout << std::endl; |
handler = new Handler(&com, &data); |
}; |
} |
void HandlerTest::tearDown(void) { |
std::cout << "result"; |
} |
void HandlerTest::get_flightctrl_settings_test(void) { |
handler->get_flightctrl_settings(0); |
}; |
} |
void HandlerTest::tearDown(void) { |
}; |
void HandlerTest::set_flightctrl_settings_test(void) { |
handler->set_flightctrl_settings(0); |
CPPUNIT_ASSERT_DOUBLES_EQUAL(1, 0, .00001); |
} |
void HandlerTest::motor_test_test(void) { |
sMotorData motor; |
handler->motor_test(motor); |
} |
void HandlerTest::reset_motor_test(void) { |
handler->reset_motor(); |
} |
void HandlerTest::read_motor_mixer_test(void) { |
handler->read_motor_mixer(); |
} |
void HandlerTest::write_motor_mixer_test(void) { |
handler->write_motor_mixer(0, 0); |
} |
void HandlerTest::get_motor_config_test(void) { |
handler->get_motor_config(0); |
} |
//NaviCtrl commands |
void HandlerTest::set_navictrl_debug_test(void) { |
handler->set_navictrl_debug(10); |
} |
void HandlerTest::stop_navictrl_debug_test(void) { |
handler->stop_navictrl_debug(); |
} |
void HandlerTest::send_waypoint_test(void) { |
Waypoint_t wp; |
handler->send_waypoint(wp); |
} |
void HandlerTest::add_waypoint_test(void) { |
Waypoint_t wp; |
handler->add_waypoint(wp); |
} |
void HandlerTest::delete_waypoints_test(void) { |
handler->delete_waypoints(); |
} |
//switch between MK modules/components |
void HandlerTest::switch_navictrl_test(void) { |
handler->switch_navictrl(); |
} |
void HandlerTest::switch_flightctrl_test(void) { |
handler->switch_flightctrl(); |
} |
void HandlerTest::switch_mk3mag_test(void) { |
handler->switch_mk3mag(); |
} |
//commands for MK3MAG |
//commands for all modules/components |
void HandlerTest::set_all_debug_test(void) { |
handler->set_all_debug(10); |
} |
void HandlerTest::stop_all_debug_test(void) { |
handler->stop_all_debug(); |
} |
void HandlerTest::get_analog_test(void) { |
handler->get_analog(); |
} |
void HandlerTest::show_lcd_test(void) { |
handler->show_lcd(); |
} |
void HandlerTest::lcd_up_test(void) { |
handler->lcd_up(); |
} |
void HandlerTest::lcd_down_test(void) { |
handler->lcd_down(); |
} |
void HandlerTest::get_version_test(void) { |
handler->get_version(); |
} |
void HandlerTest::get_ppm_channels_test(void) { |
handler->get_ppm_channels(); |
} |
/QMK-Groundstation/branches/libMK/testing/HandlerTest.h |
---|
11,6 → 11,37 |
{ |
CPPUNIT_TEST_SUITE (HandlerTest); |
CPPUNIT_TEST (get_flightctrl_settings_test); |
CPPUNIT_TEST (set_flightctrl_settings_test); |
CPPUNIT_TEST (motor_test_test); |
CPPUNIT_TEST (reset_motor_test); |
CPPUNIT_TEST (read_motor_mixer_test); |
CPPUNIT_TEST (write_motor_mixer_test); |
CPPUNIT_TEST (get_motor_config_test); |
//NaviCtrl commands |
CPPUNIT_TEST (set_navictrl_debug_test); |
CPPUNIT_TEST (stop_navictrl_debug_test); |
CPPUNIT_TEST (send_waypoint_test); |
CPPUNIT_TEST (add_waypoint_test); |
CPPUNIT_TEST (delete_waypoints_test); |
//switch between MK modules/components |
CPPUNIT_TEST (switch_navictrl_test); |
CPPUNIT_TEST (switch_flightctrl_test); |
CPPUNIT_TEST (switch_mk3mag_test); |
//commands for MK3MAG |
//commands for all modules/components |
CPPUNIT_TEST (set_all_debug_test); |
CPPUNIT_TEST (stop_all_debug_test); |
CPPUNIT_TEST (get_analog_test); |
CPPUNIT_TEST (show_lcd_test); |
CPPUNIT_TEST (lcd_up_test); |
CPPUNIT_TEST (lcd_down_test); |
CPPUNIT_TEST (get_version_test); |
CPPUNIT_TEST (get_ppm_channels_test); |
CPPUNIT_TEST_SUITE_END (); |
public: |
19,7 → 50,37 |
protected: |
void get_flightctrl_settings_test(void); |
void set_flightctrl_settings_test(void); |
void motor_test_test(void); |
void reset_motor_test(void); |
void read_motor_mixer_test(void); |
void write_motor_mixer_test(void); |
void get_motor_config_test(void); |
//NaviCtrl commands |
void set_navictrl_debug_test(void); |
void stop_navictrl_debug_test(void); |
void send_waypoint_test(void); |
void add_waypoint_test(void); |
void delete_waypoints_test(void); |
//switch between MK modules/components |
void switch_navictrl_test(void); |
void switch_flightctrl_test(void); |
void switch_mk3mag_test(void); |
//commands for MK3MAG |
//commands for all modules/components |
void set_all_debug_test(void); |
void stop_all_debug_test(void); |
void get_analog_test(void); |
void show_lcd_test(void); |
void lcd_up_test(void); |
void lcd_down_test(void); |
void get_version_test(void); |
void get_ppm_channels_test(void); |
private: |
KopterData data; |
Communication com; |
/QMK-Groundstation/branches/libMK/testing/Makefile |
---|
15,7 → 15,7 |
test: $(OBJ) |
${CPP} -o test $(LINKOBJ) $(OBJ) ${LIBS} |
./test |
# ./test |
$(LIBMK): |
$(MAKE) -C $(LIBMK_DIR) |
/QMK-Groundstation/branches/libMK/testing |
---|
Property changes: |
Added: svn:ignore |
+test |
+depend |
/QMK-Groundstation/branches/. |
---|
Property changes: |
Added: svn:ignore |
+.metadata |