HDRI Community
http://www.hdrlabs.com/cgi-bin/forum/YaBB.pl
Open Camera Controller >> OCC Developer Zone >> Step-by-step developer guide
http://www.hdrlabs.com/cgi-bin/forum/YaBB.pl?num=1297122876

Message started by Steve Chapman on 02/07/11 at 23:54:36

Title: Step-by-step developer guide
Post by Steve Chapman on 02/07/11 at 23:54:36
Day 1:

Surf to Microsoft.com/express and install Visual C++ 2010 Express edition.

Express = free!

It took two attempts before "vc_web.exe" downloaded. (You do not need Silverlight or SQL, if you want to avoid the bloatware the installer throws at you.)

Familiarize yourself with the VC IDE. http://www.cplusplus.com/ is a good reference for C++ syntax.

Title: Re: Step-by-step developer guide
Post by Steve Chapman on 02/08/11 at 21:32:03
Day 2:

Install Devkit pro from this link:
http://sourceforge.net/projects/devkitpro/files/Automated%20Installer/devkitProUpdater-1.5.0.exe

It's best to install it in the default folder c:\devkitpro

Devkitpro is an ARM & PowerPC programming system. You can use it to program for a PSP, Wii, & other systems. Don't update to newer versions as it may break our next step.

Install PALIB:
http://palib-dev.com/PAlib100707.7z

It's a 7zip file for some reason, you'll need a 7-unzipper which can be found by googling, although programs like Winzip can also deal with this archive format. Be careful if you install Winzip for this, uncheck all of the bloatware it carries, and uncheck "shell extensions" as it will take over all zip file processing from Explorer if you check this. You'll also need to do a custom setup (not "express") and uncheck the .zip and .cab file associations even though it whines and complains!

Unzip the files to a folder called c:\devkitpro\palib

PALIB is a supplement to Devkitpro that adds support for screen setup, io, sprites, fonts, and a slew of goodies that make it easier to program for the DS.

Next we'll need to figure out how to get this all to work with VC 2010 express as an IDE.

Title: Re: Step-by-step developer guide
Post by Steve Chapman on 02/08/11 at 22:57:01
Thanks to demosthenes2k8 we have a template to begin coding.

Download http://PanoCamera.com/HDRLabs/PALib2010.zip

Keep a copy of this set aside as a master template for coding future apps.

Execute the PALibTemplate.vcproj file inside the PALibTemplate folder. VC2010 will want to upgrade the file with its conversion wizard, go ahead and allow it to do this.

Next we'll begin coding a useful (for me anyways) DS Camera app.

Title: Re: Step-by-step developer guide
Post by Yogie on 04/06/11 at 13:44:28
I followed your steps so far.

But to get the Template in step 3 get to work I needed to edit the following files and adjust the path directives to several lines in the files to suit to my projects location:

main.d
MyApp.d

Otherwise I would state where to put the template to help out newcomers like me so they would not trap into the pitfall.

Cheers
Yogie

P.S. While converting the template I got two warnings - please see my attachment - I'm not quite sure if the warnings need to be considered or can be neglected. Many thanks!


screenshot.png (Attachment deleted)

Title: Re: Step-by-step developer guide
Post by Yogie on 04/06/11 at 14:40:40
P.P.S. I tried to get the source code of the OCCBracket recompiled but until now without success any idea or things I need to let you know what I did or hat the messages are?

Whilst updating and importing I got again some warnings, see at the screen shot.

And then I had to edit again some files to adjust the project path:

card_spi.d
dserial.d
main.d

then there were some files missing:

PA_IO.h - C:/devkitPro/palib/include/nds/arm9/
PA_GBFS.h - C:/devkitPro/palib/include/nds/arm9/
text0.h - C:/devkitPro/palib/include/nds/arm9/
text1.h - C:/devkitPro/palib/include/nds/arm9/
text2.h - C:/devkitPro/palib/include/nds/arm9/
text3.h - C:/devkitPro/palib/include/nds/arm9/
text4.h - C:/devkitPro/palib/include/nds/arm9/
PA_FS.h - C:/devkitPro/palib/include/nds/arm9/
PA_Video.h - C:/devkitPro/palib/include/nds/arm9/
PA_Splash.h - C:/devkitPro/palib/include/nds/arm9/
PA_Save.h - C:/devkitPro/palib/include/nds/arm9/
PA_FATLoad.h - C:/devkitPro/palib/include/nds/arm9/

gba-jpeg-decode.h - C:/devkitPro/palib/include/nds/
gba-jpeg.h - C:/devkitPro/palib/include/nds/
SoundCommon.h - C:/devkitPro/palib/include/nds/
Sound9.h - C:/devkitPro/palib/include/nds/

which I found on other PALib versions and put those file into the ZIP.

But then I got stuck. Because I'm getting a lot of warnings and errors when trying to build the project:


Code (]c:/Projects/OCCbracket/02_23_10/ver15/source/alldegrees.h: In function 'int MoveAngle(int, int)':
  c:/Projects/OCCbracket/02_23_10/ver15/source/alldegrees.h(5):42: warning: deprecated conversion from string constant to 'char*'




c:/Projects/OCCbracket/02_23_10/ver15/source/TakeAShot.h: In function 'void TakeAShot(int, bool, float, int)':
  c:/Projects/OCCbracket/02_23_10/ver15/source/TakeAShot.h(49):26: warning: comparison between signed and unsigned integer expressions



c:/Projects/OCCbracket/02_23_10/ver15/source/main.cpp: In function 'int main(int, char**)':
  c:/Projects/OCCbracket/02_23_10/ver15/source/main.cpp(51):18: warning: large integer implicitly truncated to unsigned type
  c:/Projects/OCCbracket/02_23_10/ver15/source/main.cpp(54):2: warning: 'void _PA_DeprecationStub()' is deprecated (declared at c:/devkitPro/PAlib/include/nds/arm9/PA_General.h:34)



c:/Projects/OCCbracket/02_23_10/ver15/source/main.cpp(121):39: warning: suggest parentheses around comparison in operand of '&'



c:/Projects/OCCbracket/02_23_10/ver15/source/main.cpp(648):40: warning: deprecated conversion from string constant to 'char*'
  c:/Projects/OCCbracket/02_23_10/ver15/source/main.cpp(908):2: warning: 'void _PA_DeprecationStub()' is deprecated (declared at c:/devkitPro/PAlib/include/nds/arm9/PA_General.h:34)


c:/Projects/OCCbracket/02_23_10/ver15/source/card_spi.c: In function 'cardSpiBusy':
  c:/Projects/OCCbracket/02_23_10/ver15/source/card_spi.c(39):9: error: 'CARD_CR1' undeclared (first use in this function)
  c:/Projects/OCCbracket/02_23_10/ver15/source/card_spi.c(39):9: note: each undeclared identifier is reported only once for each function it appears in
  c:/Projects/OCCbracket/02_23_10/ver15/source/card_spi.c: In function 'cardSpiStart':
  c:/Projects/OCCbracket/02_23_10/ver15/source/card_spi.c(44):2: error: 'CARD_CR1' undeclared (first use in this function)
  c:/Projects/OCCbracket/02_23_10/ver15/source/card_spi.c: In function 'cardSpiStop':
  c:/Projects/OCCbracket/02_23_10/ver15/source/card_spi.c(49):2: error: 'CARD_CR1' undeclared (first use in this function)
  c:/Projects/OCCbracket/02_23_10/ver15/source/card_spi.c: In function 'cardSpiTransfer':
  c:/Projects/OCCbracket/02_23_10/ver15/source/card_spi.c(79):2: error: 'CARD_EEPDATA' undeclared (first use in this function)
  c:/Projects/OCCbracket/02_23_10/ver15/source/card_spi.c: In function 'cardSpiTransferBuffer':
  c:/Projects/OCCbracket/02_23_10/ver15/source/card_spi.c(109):3: error: 'CARD_EEPDATA' undeclared (first use in this function)
  c:/Projects/OCCbracket/02_23_10/ver15/source/card_spi.c: In function 'cardSpiWriteBuffer':
  c:/Projects/OCCbracket/02_23_10/ver15/source/card_spi.c(147):3: error: 'CARD_EEPDATA' undeclared (first use in this function)
  c:/Projects/OCCbracket/02_23_10/ver15/source/card_spi.c: In function 'cardSpiTransfer':
  c:/Projects/OCCbracket/02_23_10/ver15/source/card_spi.c(91):1: warning: control reaches end of non-void function
  c:/Projects/OCCbracket/02_23_10/ver15/source/card_spi.c: In function 'cardSpiBusy':
  c:/Projects/OCCbracket/02_23_10/ver15/source/card_spi.c(40):1: warning: control reaches end of non-void function
  make[1):

: *** [card_spi.o] Error 1
  make: *** [build] Error 2
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========


I tried to catch any kind of warning and error in the code above, maybe you can help out?
I also tried to compile the code on a C++ 2008 installation but with the same outcome.

Any help or idea?

Many thanks in advance…

Yogie
occ-screenshot.png (Attachment deleted)
PALib_include_nds.zip (Attachment deleted)

Title: Re: Step-by-step developer guide
Post by Yogie on 04/10/11 at 15:51:17
Today I was able to rebuild the source of the

Intervalometer
Sunrise

although they are throwing many warnings.

The SoundTrigger and Bracket sources keep throwing errors and warnings and will not be build.



Soundtrigger looks like this:


Code (]------ Build started: Project: SoundTrigger, Configuration: Release Win32 ------
  Build process start for project "SoundTrigger"...
 
  card_spi.c
  c:/Projects/SoundTrigger/source/card_spi.c: In function 'cardSpiBusy':
  c:/Projects/SoundTrigger/source/card_spi.c(39):9: error: 'CARD_CR1' undeclared (first use in this function)
  c:/Projects/SoundTrigger/source/card_spi.c(39):9: note: each undeclared identifier is reported only once for each function it appears in
  c:/Projects/SoundTrigger/source/card_spi.c: In function 'cardSpiStart':
  c:/Projects/SoundTrigger/source/card_spi.c(44):2: error: 'CARD_CR1' undeclared (first use in this function)
  c:/Projects/SoundTrigger/source/card_spi.c: In function 'cardSpiStop':
  c:/Projects/SoundTrigger/source/card_spi.c(49):2: error: 'CARD_CR1' undeclared (first use in this function)
  c:/Projects/SoundTrigger/source/card_spi.c: In function 'cardSpiTransfer':
  c:/Projects/SoundTrigger/source/card_spi.c(79):2: error: 'CARD_EEPDATA' undeclared (first use in this function)
  c:/Projects/SoundTrigger/source/card_spi.c: In function 'cardSpiTransferBuffer':
  c:/Projects/SoundTrigger/source/card_spi.c(109):3: error: 'CARD_EEPDATA' undeclared (first use in this function)
  c:/Projects/SoundTrigger/source/card_spi.c: In function 'cardSpiWriteBuffer':
  c:/Projects/SoundTrigger/source/card_spi.c(147):3: error: 'CARD_EEPDATA' undeclared (first use in this function)
  c:/Projects/SoundTrigger/source/card_spi.c: In function 'cardSpiTransfer':
  c:/Projects/SoundTrigger/source/card_spi.c(91):1: warning: control reaches end of non-void function
  c:/Projects/SoundTrigger/source/card_spi.c: In function 'cardSpiBusy':
  c:/Projects/SoundTrigger/source/card_spi.c(40):1: warning: control reaches end of non-void function
  make[1):

: *** [card_spi.o] Error 1
  make: *** [build] Error 2
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========


Is my installation buggy or why do I have such troubles?

Title: Re: Step-by-step developer guide
Post by Yogie on 04/10/11 at 16:57:40
Hi,

at first I was able to reduce the warnings and arrors.

In card_spi I changed

REG_EXEMEMSTAT to REG_EXMEMSTAT

but still no progress in building the .nds files.

It seems that there is something wrong with the DSSerial Version and or PAlib Version?

Any help would be appreachiated I'm just a beginner and player with C++ and coding in general...

Cheers
Yogie

Title: Re: Step-by-step developer guide
Post by Steve Chapman on 04/11/11 at 23:56:19
Good news everybody!
It seems you can still download VC++ express 2008 version from MS, which should allow one to compile our existing older code.

Title: Re: Step-by-step developer guide
Post by Yogie on 04/12/11 at 12:31:25
Well I tried the VC++ express 2008 version and ran into the same problems!

The benefit for the express 2008 version is that this one works with the PALib AppWizard that let you create a new app with the VC++ internal dialogs the only thing you need to update was the make file ... http://www.palib.info/wiki/doku.php?id=day1#installation


Title: Re: Step-by-step developer guide
Post by Steve Chapman on 04/12/11 at 19:19:05
I'm sorry to hear that. Are you trying to modify the existing code or planning a new app or new function?

Title: Re: Step-by-step developer guide
Post by Yogie on 04/12/11 at 19:49:25
First of all I would like to try to rebuild the app as is.

At the next step I would like to learn from the code and see if I can catch up and modify it.
First thing to modify could be to change the bitmaps with ones that have German language.

Then I would like to check if I can change the pause time between the shots. As by now the pause has the same shutter time and increases each time like the shutter time but I think the pause could be limited or set to be fix to a specific time to shorten the whole process.

Then I will see if there is more that can be done... ;)
Or write my own Remote control app for other topics like having an ND calculator etc. and set the shutter time from the calculation etc.

But I'm a beginner in programming so nothing that will come up very quickly out of my computer, so do not expect to much, I would be more than happy to get the first step done and get the source rebuild here.
   

Title: Re: Step-by-step developer guide
Post by Steve Chapman on 04/16/11 at 00:49:53
It'd be great to have your involvement. There already is a adjustment for the delay between shots, btw, it's the (perhaps vaguely labeled) memory slider on the right.

My suggestion is to strip out everything and start learning to control in a simple matter the "Takeshot" function. All of the dserial code exists only to control the motor mount, so it is entirely optional and can be excised by removing all of the dserial include files.

Title: Re: Step-by-step developer guide
Post by Yogie on 04/16/11 at 09:11:00
Thanks Steve,

so I will go for that, I try to get it recompiled without the dserial code and then start to look around.

Thank you so much for your help and can't wait to follow you here with your first lesson :-D


wrote on 02/08/11 at 22:57:01:
Next we'll begin coding a useful (for me anyways) DS Camera app.



Title: Re: Step-by-step developer guide
Post by Yogie on 04/19/11 at 20:05:07

wrote on 04/16/11 at 00:49:53:
My suggestion is to strip out everything and start learning to control in a simple matter the "Takeshot" function. All of the dserial code exists only to control the motor mount, so it is entirely optional and can be excised by removing all of the dserial include files.


Well I tried to do that but I think I was not able to catch all that needed to stripped out or even did too much, I don't know.

It is very hard for me to understand as I'm totally new to this…


Steve would it be possible for you to stripe out the DSSERIAL stuff and send me a clean version of the project please?

Title: Re: Step-by-step developer guide
Post by Yogie on 04/21/11 at 15:03:37
I still have over 70 warnings but I could at least build an NDS file, I had fewer warnings with the C++ 2008 Version so I skipped using 2010!

As I'm not quite sure if still all functionality is given, please find a beta of the German version.

Happy Easter Days!
OCC15_1bGER.zip (Attachment deleted)

Title: Re: Step-by-step developer guide
Post by Steve Chapman on 04/22/11 at 16:08:16
I don't know why Microsoft deprecates so much with every revision. Most of the warnings, though, are moot.

Title: Re: Step-by-step developer guide
Post by Yogie on 04/04/12 at 11:00:56
Hi Steve,

I found some code where in OCC milliseconds would be displayed in minutes and seconds... I would like to know if you can help me out with it on how to display milliseconds in days HH:mm:ss.ms?

ExposureTime is a value of x milliseconds...

This is what I found and slightly changed:


            
Code (c++):
TimeEstimate = ExposureTime;
            TimeEstimateDays= ________________;
            TimeEstimateHours= ________________;
            TimeEstimateMinutes=(TimeEstimate/1000)/60;
            TimeEstimateSeconds=(TimeEstimate/1000)-(TimeEstimateMinutes*60);
            TimeEstimateMilliseconds= ________________;

            // days
            ________________;
            // hours
            ________________;
            // minutes
            dummy=TimeEstimateMinutes-(int(TimeEstimateMinutes/10)*10);
            PA_OutputText (1,18,5,"%d:",dummy);
            dummy=int((TimeEstimateMinutes-dummy)/10);
            PA_OutputText (1,17,5,"%d",dummy);
            // seconds
            dummy=TimeEstimateSeconds-(int(TimeEstimateSeconds/10)*10);
            PA_OutputText (1,21,5,"%d",dummy);
            dummy=int((TimeEstimateSeconds-dummy)/10);
            PA_OutputText (1,20,5,"%d",dummy);
            // milliseconds
            ________________;


Any idea? ::)

Thanks in advance

Title: Re: Step-by-step developer guide
Post by Yogie on 05/04/12 at 11:21:35
Can't wait for your start! :-)

Title: Re: Step-by-step developer guide
Post by Steve Chapman on 05/06/12 at 03:20:24
I was really hoping for more community participation with this. Maybe I could do a line-by-line commentary of the basic trigger program?

Title: Re: Step-by-step developer guide
Post by Yogie on 05/10/12 at 11:16:54
Well this would be something that is better than nothing :-)

Title: Re: Step-by-step developer guide
Post by Yogie on 06/06/12 at 07:47:28

wrote on 04/22/11 at 16:08:16:
I don't know why Microsoft deprecates so much with every revision. Most of the warnings, though, are moot.


Well the deprecation warning are not coming from the MS environment they are directly from the PAlib. All other warnings and errors I had could be eliminated by just changing the code a bit and following the instructions of the messages, for example...

REG_EXMEMCNT = ~0x8080;

is throwing an error and I found out writing it like this:

REG_EXMEMCNT &= ~(0x8080);      

is fine and does not give any error or warning anymore!

And I also have had a warning in the OCC main routine TakeAShot which I could eliminate, but this was just because you compared different data types to each other.

HDRI Community » Powered by YaBB 2.5.2!
YaBB Forum Software © 2000-2018. All Rights Reserved.