Subversion Repositories Projects

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
750 KeyOz 1
/***************************************************************************
2
 *   Copyright (C) 2008 by Manuel Schrape                                  *
3
 *   manuel.schrape@gmx.de                                                 *
4
 *                                                                         *
5
 *   This program is free software; you can redistribute it and/or modify  *
6
 *   it under the terms of the GNU General Public License as published by  *
7
 *   the Free Software Foundation; either version 2 of the License.        *
8
 *                                                                         *
9
 *   This program is distributed in the hope that it will be useful,       *
10
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
11
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
12
 *   GNU General Public License for more details.                          *
13
 *                                                                         *
14
 *   You should have received a copy of the GNU General Public License     *
15
 *   along with this program; if not, write to the                         *
16
 *   Free Software Foundation, Inc.,                                       *
17
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
18
 ***************************************************************************/
19
#include "dlg_MotorTest.h"
20
 
21
dlg_MotorTest::dlg_MotorTest(QWidget *parent) : QDialog(parent)
22
{
23
    setupUi(this);
24
 
25
    Timer = new QTimer();
26
    Timer->setInterval(250);
27
 
28
    connect(sl_Speed, SIGNAL(valueChanged(int)), this, SLOT(slot_MotorTest(int)));
29
    connect(Timer, SIGNAL(timeout()), this, SLOT(slot_Timer()));
30
}
31
 
32
void dlg_MotorTest::slot_MotorTest(int Wert)
33
{
34
    if ((Wert > 0) && !(Timer->isActive()))
35
    {
36
        Timer->start();
37
    }    
38
 
39
    for (int z = 0; z < 16; z++)
40
    {
41
        Motor[z] = 0;
42
    }
43
 
44
    if (cb_1->isChecked())
45
        Motor[0] = Wert;
46
    if (cb_2->isChecked())
47
        Motor[1] = Wert;
48
    if (cb_3->isChecked())
49
        Motor[2] = Wert;
50
    if (cb_4->isChecked())
51
        Motor[3] = Wert;
52
    if (cb_5->isChecked())
53
        Motor[4] = Wert;
54
    if (cb_6->isChecked())
55
        Motor[5] = Wert;
56
    if (cb_7->isChecked())
57
        Motor[6] = Wert;
58
    if (cb_8->isChecked())
59
        Motor[7] = Wert;
60
    if (cb_9->isChecked())
61
        Motor[8] = Wert;
62
    if (cb_10->isChecked())
63
        Motor[9] = Wert;
64
    if (cb_11->isChecked())
65
        Motor[10] = Wert;
66
    if (cb_12->isChecked())
67
        Motor[11] = Wert;
68
}
69
 
70
void dlg_MotorTest::slot_Timer()
71
{
72
    memcpy((unsigned char *)&c_Data, (unsigned char *)&Motor, sizeof(Motor));
73
 
74
    emit sig_SendData(HandlerMK::make_Frame('t', ADDRESS_FC, c_Data, sizeof(Motor)).toLatin1().data(), 0);
75
}
76
 
77
void dlg_MotorTest::Stop()
78
{
79
    Timer->stop();
80
}
81
 
82
dlg_MotorTest::~dlg_MotorTest()
83
{
84
}
85
 
86