You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

92 lines
3.7 KiB

#include "gpioWindow.h"
gpioWindow::gpioWindow() : WindowCLI(NULL){
m_x = 1;
m_y = 18;
m_w = 80;
m_h = 17;
#ifdef NEWT_CLI
m_t1 = newtTextbox( 2, 1, 60, 1, 0 );
m_t2 = newtTextbox( 2, 2, 60, 1, 0 );
m_t3 = newtTextbox( 2, 3, 60, 1, 0 );
m_t4 = newtTextbox( 2, 4, 60, 1, 0 );
m_t5 = newtTextbox( 2, 5, 60, 1, 0 );
m_t6 = newtTextbox( 2, 6, 60, 1, 0 );
newtFormAddComponents( m_oForm, m_t1, m_t2, m_t3, m_t4, m_t5, m_t6, NULL );
#else
//create( 41, 18, 80, 17 );
create( 1, 18, 80, 17 );
#endif
};
gpioWindow::~gpioWindow(){
newtPopWindow();
};
void gpioWindow::paint( void ){
char tBuffer[245];
m_nGPI0 = getInputsGPIO(0);
m_nGPI1 = getInputsGPIO(1);
m_nGPI2 = getInputsGPIO(2);
m_nGPI3 = getInputsGPIO(3);
m_nGPI4 = getInputsGPIO(4);
m_nGPI5 = getInputsGPIO(5);
m_nGPO0 = getOutputsGPIO(0);
m_nGPO1 = getOutputsGPIO(1);
m_nGPO2 = getOutputsGPIO(2);
m_nGPO3 = getOutputsGPIO(3);
m_nGPO4 = getOutputsGPIO(4);
m_nGPO5 = getOutputsGPIO(5);
#ifdef NEWT_CLI
newtCenteredWindow( m_w, m_h, "GPIO Info" );
sprintf( tBuffer, "GPIO[0] Input:\t0x%08x\tGPIO[0] Output:\t0x%08x", m_nGPI0, m_nGPO0 );
newtTextboxSetText( m_t1, tBuffer );
sprintf( tBuffer, "GPIO[1] Input:\t0x%08x\tGPIO[1] Output:\t0x%08x", m_nGPI1, m_nGPO1 );
newtTextboxSetText( m_t2, tBuffer );
sprintf( tBuffer, "GPIO[2] Input:\t0x%08x\tGPIO[2] Output:\t0x%08x", m_nGPI2, m_nGPO2 );
newtTextboxSetText( m_t3, tBuffer );
sprintf( tBuffer, "GPIO[3] Input:\t0x%08x\tGPIO[3] Output:\t0x%08x", m_nGPI3, m_nGPO3 );
newtTextboxSetText( m_t4, tBuffer );
sprintf( tBuffer, "GPIO[4] Input:\t0x%08x\tGPIO[4] Output:\t0x%08x", m_nGPI4, m_nGPO4 );
newtTextboxSetText( m_t5, tBuffer );
sprintf( tBuffer, "GPIO[5] Input:\t0x%08x\tGPIO[5] Output:\t0x%08x", m_nGPI5, m_nGPO5 );
newtTextboxSetText( m_t6, tBuffer );
newtDrawForm( m_oForm );
newtRefresh();
#else
createBox( true );
uint32_t KAKA = findInterleave();
mvwprintw( m_pWND, 2,2,"--- MOTOR STATUS ---" );
if( tTUPUS != NULL ) {
cur_P2P_HM = tTUPUS->HOST_data;
if( cur_P2P_HM < min_P2P_HM ) min_P2P_HM = cur_P2P_HM;
if( cur_P2P_HM > max_P2P_HM ) max_P2P_HM = cur_P2P_HM;
cur_P2P_VM = tTUPUS->PRU_data;
if( cur_P2P_VM < min_P2P_VM ) min_P2P_VM = cur_P2P_VM;
if( cur_P2P_VM > max_P2P_VM ) max_P2P_VM = cur_P2P_VM;
mvwprintw( m_pWND, 3,2,"Signature:\t0x%08x", tTUPUS->PRU_id );
mvwprintw( m_pWND, 4,2,"Host status:\t0x%08x Interleave:%d", tTUPUS->HOST_status, KAKA );
mvwprintw( m_pWND, 5,2,"Host cmd:\t0x%08x", tTUPUS->HOST_command );
mvwprintw( m_pWND, 6,2,"Motor Status: %s", (( tTUPUS->PRU_status & 0xFF000000)?"Synced":"Not Synced"));
mvwprintw( m_pWND, 7,2,"Vertical Pulses per Rotation:\t%08d", tTUPUS->PRU_address );
mvwprintw( m_pWND, 8,2,"Horizontal Pulses per Rotation:\t%08d", tTUPUS->HOST_address );
mvwprintw( m_pWND, 9,2,"Horizontal Freq:\t%.2f kHz. Max: %.2f Min: %.2f",
1000000.0/( cur_P2P_HM * 5.0 ),
1000000.0/( min_P2P_HM * 5.0 ),
1000000.0/( max_P2P_HM * 5.0 )
);
mvwprintw( m_pWND, 10,2,"Vertical Freq:\t%.2f kHz. Max: %.2f Min: %.2f",
1000000.0/( cur_P2P_VM * 5.0 ),
1000000.0/( min_P2P_VM * 5.0 ),
1000000.0/( max_P2P_VM * 5.0 )
);
mvwprintw( m_pWND, 12,2,"Stat File:\tNot Started Yet" );
mvwprintw( m_pWND, 13,2,"Harvesting Stat:\tNot Started Yet" );
mvwprintw( m_pWND, 14,2,"Harvesting Status:\t\t\t." );
tTUPUS->HOST_status = 0;
} else {
mvwprintw( m_pWND, 3,2,"Not Initialized");
};
wrefresh( m_pWND );
#endif
};