Conflicts:
	src/neutrino.cpp


Origin commit data
------------------
Commit: af8c4b8d97
Author: vanhofen <vanhofen@gmx.de>
Date: 2017-02-12 (Sun, 12 Feb 2017)
This commit is contained in:
vanhofen
2017-02-12 23:01:15 +01:00
35 changed files with 111 additions and 43 deletions

View File

@@ -25,6 +25,7 @@
#include <global.h>
#include <neutrino.h>
#include "cc_draw.h"
#include "cc_timer.h"
#include <cs_api.h>
#include <system/debug.h>
@@ -774,6 +775,7 @@ bool CCDraw::paintBlink(const int& interval, bool is_nano)
{
if (cc_draw_timer == NULL)
cc_draw_timer = new CComponentsTimer(interval, is_nano);
cc_draw_timer->setThreadName(__func__);
return paintBlink(cc_draw_timer);
}
@@ -794,4 +796,4 @@ bool CCDraw::cancelBlink(bool keep_on_screen)
return res;
}
}

View File

@@ -27,7 +27,6 @@
#include "cc_types.h"
#include "cc_signals.h"
#include "cc_timer.h"
#include <driver/colorgradient.h>
#include <driver/framebuffer.h>
#include <driver/fade.h>
@@ -38,6 +37,7 @@
Basic paint attributes and member functions for component classes
*/
class CComponentsTimer;
class CCDraw : public COSDFader, public CComponentsSignals
{
protected:

View File

@@ -29,6 +29,7 @@
#include <neutrino.h>
#include "cc_frm_clock.h"
#include "cc_timer.h"
#include <time.h>
#include <unistd.h>
@@ -320,6 +321,7 @@ bool CComponentsFrmClock::startClock()
if (cl_timer == NULL){
cl_timer = new CComponentsTimer(0);
cl_timer->setThreadName("frmClock");
if (cl_timer->OnTimer.empty()){
dprintf(DEBUG_INFO,"\033[33m[CComponentsFrmClock]\t[%s] init slot...\033[0m\n", __func__);
cl_timer->OnTimer.connect(cl_sl_show);

View File

@@ -34,13 +34,13 @@
#include <driver/neutrinofonts.h>
#include "cc_base.h"
#include "cc_frm.h"
#include "cc_timer.h"
#include "cc_text_screen.h"
//! Sub class of CComponents. Show clock with digits on screen.
/*!
Usable as simple fixed display or as ticking clock.
*/
class CComponentsTimer;
class CComponentsFrmClock : public CComponentsForm, public CCTextScreen
{
private:

View File

@@ -33,11 +33,13 @@
#include <errno.h>
#include <system/helpers.h>
#include <system/debug.h>
#include <system/set_threadname.h>
using namespace std;
CComponentsTimer::CComponentsTimer(const int& interval, bool is_nano)
{
name = "unnamed";
tm_thread = 0;
tm_interval = interval;
tm_enable_nano = is_nano;
@@ -56,7 +58,8 @@ CComponentsTimer::~CComponentsTimer()
void CComponentsTimer::runSharedTimerAction()
{
//start loop
string tn = "cc:"+name;
set_threadname(tn.c_str());
while(tm_enable && tm_interval > 0) {
tm_mutex.lock();
OnTimer();

View File

@@ -63,6 +63,9 @@ class CComponentsTimer : public sigc::trackable
///flag to control thread state
bool tm_enable;
///name for the thread
std::string name;
///mutex for timer
OpenThreads::Mutex tm_mutex;
///slot for restart signals
@@ -120,6 +123,13 @@ class CComponentsTimer : public sigc::trackable
*/
void setTimerInterval(const int& interval, bool is_nano = false);
/**set thread name
* @param[in] thread name
* @return
* void
*/
void setThreadName(const std::string& n) { name = n; };
/**Provides a signal handler to receive any function or methode.
* Use this in your class where ever you need time controled actions.
*